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

what is the function of catx syntax? : Sas-administrator

0 Answers  


Describe the ways in which you can create macro variables?

0 Answers  


What is the difference between SAS Data step and SAS PROC SQL, and which is better?

1 Answers   TCS,


how will you locate the sas platform applications? : Sas-bi

0 Answers  


Does SAS ?Translate? (compile) or does it ?Interpret?? Explain.

10 Answers  






what are input dataset and output dataset options? : Sas programming

0 Answers  


what is sas and what are the functions? : Sas-administrator

0 Answers  


How do you connect the desktop application to metadata server? : sas-grid-administration

0 Answers  


The Lion King is hosting an animal conference. All the animals in the world attend except one. Which animal does not attend?

6 Answers   Oracle,


If you need the value of a variable rather than the variable itself what would you use to load the value to a macro variable?

2 Answers  


Explain the difference between using drop = data set option in set and data statement?

0 Answers  


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

3 Answers  


Categories