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 would you delete duplicate observations?
i want to upload titles and footnotes to excel file?how it is possible?
1.What is the difference between _NULL_ , _ALL_, and _N_? 2.What are the uses of _NULL_ using in Data Steps? Can we _NULL_ in Proc Steps also? 3.How do call the macro variable in Data Steps? 4.How to construct Pivot tables in Excel Using SAS?
How many tiers in sas architecture?
What are the statements in proc sql?
What is the use of %include statement?
What is the differnce between SDTM 3.1.2 to 3.1.1 version
How do you define proc in sas? : sas-grid-administration
How are the analysis data sets structured?
how would you create multiple observations from a single observation? : Sas programming
What are the applications primarily used by business analyst? : Sas-bi
How do you debug macros?