data task;
input id date date9. visit;
cards;
101 01jan2015 1
101 02jan2015 2
101 06jan2015 3
102 04jan2015 1
102 07jan2015 2
102 12jan2015 3
103 06jan2015 1
103 13jan2015 2
;
run;
write a program to find out missing dates between visits by each subject.
data task;
input id date date9. visit ;
cards;
101 01jan2015 1
101 02jan2015 2
101 06jan2015 3
102 04jan2015 1
102 07jan2015 2
102 12jan2015 3
103 06jan2015 1
103 13jan2015 2
;
run;
Answer
data task1;
set task;
by id;
date1=lag(date);
if first.id ne 1 then x=date-date1;
run;
proc print; run;
proc transpose data = task out = b;
var date;
by id;
run;
data new;
set b;
x=col2-col1;
y=col3-col2;
run;
proc print; run;
| Is This Answer Correct ? | 0 Yes | 0 No |
How to Rename Library?
What is the difference between order and group variable in proc report?
What are the main differences between sas versions 8.2, 9.0, 9.1?
what is the use of proc contents and proc print in sas? : Sas-administrator
At compile time when a SAS data set is read, what items are created?
how do you pull data from equifax?tell me the process?
0 Answers Synchrony Financial,
How to create a permanent sas data set?
how to know the attributes of first five datasets in a library
What is the function of Stop statement in a SAS Program?
proc means? proc sort? proc append? proc freq? proc print? proc content?
What is the difference between match merge and one to one merge?
what cause the "error: connect:" and "error in the libname statement" when there weren't any such problems?