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 ..

Answer / 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

More SAS Interview Questions

Do you think professionally?

1 Answers   Oracle,


In the flow of DATA step processing, what is the first action in a typical DATA Step?

9 Answers  


what is the primary data source for the wrs? : Sas-bi

0 Answers  


I am looking to buy a sas advance book. So any one can guide me that which one i should buy.

0 Answers  


if we dont want to print output what we have to do..???give syntax..???

8 Answers   Accenture, GSK GlaxoSmithKline,






Are you involved in writing the inferential analysis plan? Tables specfications?

0 Answers  


How would you remove a format that has been permanently associated with a variable? ________________

5 Answers   Quintiles, TCS,


How to read multiple excel sheets from a single excel file at once????

7 Answers   HCL, Verinon Technology Solutions,


how to assign a macro value to a variable?

8 Answers   CitiGroup,


Differentiate between sas functions and sas procedures.

0 Answers  


what is SAS/Access and SAS/Connect?what are the uses?

3 Answers  


What is the difference Using & and && in the macro variables

5 Answers   Accenture,


Categories