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.
Answer Posted / chaudhary_1989
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 |
Post New Answer View All Answers
In ARRAY processing, what does the DIM function do?
List out some key concept of SAS
What are pdv and it functions?
How to create list output for cross-tabulations in proc freq?
How you can read the variables that you need?
Describe the function and untility of the most difficult SAS macro that you have written.
what is hash files in sas and why we are using this one in sas?
How to limit decimal places for the variable using proc means?
What is the difference between order and group variable in proc report?
what is the effect of the options statement errors=1? : Sas programming
What is the maximum length of the macro variable?
What are the new features included in the new version of SAS Programming Language?
how would you determine the number of missing or nonmissing values in computations? : Sas programming
what are sas bi dashboard components? : Sas-bi
How long can a macro variable be? A token? : sas-macro