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


Please Help Members By Posting Answers For Below Questions

how many types of prompts are there? : Sas-bi

557


What are the data types does SAS contain?

659


: and & modifiers.

868


Explain the difference between nodup and nodupkey options?

613


What do you know about sas data set?

600






what is the difference between floor and ceil functions in sas? : Sas-administrator

708


What is a method to debug and test your SAS program?

726


What are the data types in sas?

615


what is the use of proc sql? : Sas programming

600


what is the one statement to set the criteria of data that can be coded in any step? : Sas programming

654


Mention what are the data types does SAS contain?

699


What do you know about symput and symget?

733


explain the difference between alternate key, business key, foreign key, generated key, primary key, retained key and surrogate key ? : Sas-di

551


Explain data step in SAS

633


what is study design in while working with SAS? what are screening variables in SAS?

1685