data medi;
infile'C:\Documents and Settings\mobileclub\Desktop\source\DLM\logicalvar.txt';
input pid $ date :date9. drug $;
format date date9.;
run;
proc sort data=medi out=medi1;
by pid;
run;
data first;
set medi1;
by pid;
if first.pid=1;
run;
proc print data=first;
run;
data last;
set medi1;
by pid;
if last.pid=1;
run;
proc print data=last;
run;
data last1;
set medi1;
by pid;
if last.pid=0;
run;
proc print data=last1;
run;
data first1;
set medi1;
by pid;
if first.pid=0;
run;
proc print data=first1;
run;
data first2;
set medi1;
by pid;
if first.pid=1 and last.pid=1;
run;
proc print data=first2;
run;
data first3;
set medi1;
by pid;
if first.pid=0 and last.pid=0;
run;
proc print data=first3;
run;
No comments:
Post a Comment