Dear All, I have one very simple question:
Q1: How could below dataset be input successfully?
Here is the data I have, which is created by below code:
data have; input subjid avisit dat $20.; datalines; 1001 0 1997-01-01 1001 1 1997-02-01 1001 2 1001 3 1997-05-01 1002 0 1998-01-01 1002 1 1998-02-01 1002 2 1002 3 1002 4 1002 5 1002 6 1998-12-01 1003 0 1999-01-01 1003 1 1999-02-01 1003 2 1003 3 1999-03-08 1003 4 1003 5 1999-04-05 1003 6 1999-05-01 1003 7 1003 8 ; run;
data have_; set have; adt=input(dat, yymmdd10.); attrib adt format=yymmdd10.;
run;
Q2: If you look at the last variable adt generated by below dataset WANT (which, unfortunately I can't produce by below code successfully, please assist me as well), you will see actually, I want to derive the last non-missing dat which should prior the consecutive dat, but I have no idea how to derive the last column, base on the first 3 variable correctly, hope you can help me.
data want; infile datalines delimiter=","; input subjid avisit dat $20. adt $20.; datalines; 1001,0,1997-01-01,1997-05-01 1001,1,1997-02-01,1997-05-01 1001,2, ,1997-05-01 1001,3,1997-05-01,1997-05-01 1002,0,1998-01-01,1998-02-01 1002,1,1998-02-01,1998-02-01 1002,2, ,1998-02-01 1002,3, ,1998-02-01 1002,4, ,1998-02-01 1002,5, ,1998-02-01 1002,6,1998-12-01,1998-02-01 1003,0,1999-01-01,1999-05-01 1003,1,1999-02-01,1999-05-01 1003,2, ,1999-05-01 1003,3,1999-03-08,1999-05-01 1003,4, ,1999-05-01 1003,5,1999-04-05,1999-05-01 1003,6,1999-05-01,1999-05-01 1003,7, ,1999-05-01 1003,8, ,1999-05-01 ; run;
... View more