Proc sort data=dm.dsrand out= dsrand (keep=subjid siteid country visit form DSDAT);
by subjid siteid country;
run;
proc sort data=dm.sv out=sv (keep=subjid siteid country visit visitnum form SVSDAT);
by subjid visit;
run;
proc sort data=dm.dsic out= ic (keep= subjid siteid country visit visitnum form DSPROT);
by subjid visit;
run;
data VS;
retain subjid siteid country visit visitnum form DSPROT DSDAT SVSDAT;
merge dsrand ic sv;
by subjid siteid country;
run;
/* deriving visits based on visit windows*/
%macro visitdate (vsvar=VS , stdyvar=,visvar=);
%if vsvar=”B %then %do;
If &stdyvar = 1 then &visvar = 1;
Else if 28 <= &stdyvar <= 32 then &visvar=2;
Else if 91 <= &stdyvar <= 98 then &visvar=3;
Else if 182 <= &stdyvar <= 189 then &visvar=4;
Else if 273 <= &stdyvar <= 280 then &visvar=5;
Else if 364 <= &stdvar <= 371 then &visvar=6;
Else if 455 <= &stdvar <= 462 then &visvar=7;
Else if 546 <=&stdvar <= 553 then &visvar=8;
Else if 574 <=&stdvar <= 581 then &visvar=9;
If &visvar = .
Then put “War” “ning: Visit window error”;
%end;
%mend visitdate;
%Macro visitdate (stdyvar=,visvar=);
proc sort data=VS;
by &stdyvar &visvar;
proc print data= VS;
Var subjid siteid country visit visitnum form DSPROT DSDAT SVSDAT;
%Mend; i created this code but doesn't seem to work. i want to predict when would be the next scheduled visit for the patient due with the protocol visit schedule. kind regards neha
... View more