Skip to main content


Showing posts from December, 2019

Simulation of hemophilia bleeds

A SAS simulation study describing bleeds in hemophilia type A and B patients. Based on the "proof-of-concept study" Randomized, prospective clinical trial of recombinant factor VIIa for secondary prophylaxis in hemophilia patients with inhibitors by Konkle et. al. published in Journal of Thrombosis and Haemostasis, 5: 1904-1913 in 2007. The epidemiology and design of the study are not in accordance with CONSORT and SPIRIT as of December 2019. We observe 22 included patients (11 in each group) allocated from 20 sites in 11 countries. Neither the randomization nor the analysis is stratified by center, and it is possible to question the logistics of the experiment. People have asked if a condition on the number of bleeds (above 4 for each month in the pre-prophylaxis period) introduces bias: The study is a comparison of the effect of dose-difference not the effect of the drug, although the mean of bleeds in the first period is obviously higher than in the second period. Suspic

Indicators from numeric factor variables

The macro call below will generate indicators for all factor levels of xfaktor from the data set regdata represented by at least 5 observations. I have developed the macroes to avoid class variables in SAS regression analyses. %indicator(xfaktor,regdata,5); /* Macro to generate dummy variables. */ %MACRO GETCON;   %DO I = 1 %TO &N;   %IF &&M&I NE 0 %THEN %PUT &factor&I;   %IF &&M&I = 0 %THEN %GOTO OUT;     IF &factor = &&M&I THEN &factor&I = 1;     ELSE &factor&I = 0;   %OUT: %END; %MEND GETCON; %macro indicator(factor,dataset,size); data tbl_data_; set &dataset(keep=&factor); run; proc sort data=tbl_data_; by &factor; run; data tbl_; set tbl_data_; by &factor; retain sz; if first.&factor then sz=1; else sz=sz+1; if last.&factor then output; run; PROC SORT DATA=tbl_(where=(sz GE &size)) OUT=UNIQUE NODUPKEY;   BY &factor; RUN; /* Assign the largest value o