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
how many types of prompts are there? : Sas-bi
What are the data types does SAS contain?
: and & modifiers.
Explain the difference between nodup and nodupkey options?
What do you know about sas data set?
what is the difference between floor and ceil functions in sas? : Sas-administrator
What is a method to debug and test your SAS program?
What are the data types in sas?
what is the use of proc sql? : Sas programming
what is the one statement to set the criteria of data that can be coded in any step? : Sas programming
Mention what are the data types does SAS contain?
What do you know about symput and symget?
explain the difference between alternate key, business key, foreign key, generated key, primary key, retained key and surrogate key ? : Sas-di
Explain data step in SAS
what is study design in while working with SAS? what are screening variables in SAS?