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

How would you delete duplicate observations?

10 Answers   Accenture,


i want to upload titles and footnotes to excel file?how it is possible?

1 Answers  


1.What is the difference between _NULL_ , _ALL_, and _N_? 2.What are the uses of _NULL_ using in Data Steps? Can we _NULL_ in Proc Steps also? 3.How do call the macro variable in Data Steps? 4.How to construct Pivot tables in Excel Using SAS?

3 Answers  


How many tiers in sas architecture?

2 Answers  


What are the statements in proc sql?

0 Answers  






What is the use of %include statement?

0 Answers  


What is the differnce between SDTM 3.1.2 to 3.1.1 version

0 Answers   Wipro,


How do you define proc in sas? : sas-grid-administration

0 Answers  


How are the analysis data sets structured?

3 Answers  


how would you create multiple observations from a single observation? : Sas programming

0 Answers  


What are the applications primarily used by business analyst? : Sas-bi

0 Answers  


How do you debug macros?

3 Answers   Accenture,


Categories