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
what is the Population you used in your project, is it ITT or PP?
What are the difficulties u faced while doing vital signs table or dataset?
What is the difference between SAS functions and procedures?
what are some problems you might encounter in processing missing values? In data steps? Arithmetic? Comparisons? Functions? Classifying data? : Sas programming
What is the basic structure of the SAS base program?
what is the purpose of _error_? : Sas programming
why is sas considered self-documenting? : Sas programming
Hello Friends, am new to this forum and am not good at sas progarmming. please can any one of you send me couple of sample large sample SAS Jobs which can you use 200 MB of data and other sas job upto 25GB of data. am doing a performance testing on our legacy systems and new upgraded system. I would really appreciate if you can do me this favor Thank you Priya
For what purpose would you use the RETAIN statement?
What does proc print, and proc contents are used for?
Do you need to rearrange the order of the data for the report?
What is substr function?
How would you code a merge that will write the matches of both to one data set, the non-matches from the left-most data?
What is the difference between order and group variable in proc report?
what is the basic structure sas administrator? : Sas-administrator