data VS;
input ptid @5 vsdtc ddmmyy10. @17 result;
format vsdtc ddmmyy10.;
cards;
101 24/10/2018 110
101 25/10/2018 120
101 26/10/2018 115
101 27/10/2018 125
101 28/10/2018 135
102 23/10/2018 130
102 25/10/2018 120
102 26/10/2018 110
102 29/10/2018 115
102 30/10/2018 125
103 24/10/2018 120
103 26/10/2018 140
103 27/10/2018 110
103 28/10/2018 115
103 28/10/2018 145
;
run;
data DM;
input ptid @8 rfstdtc ddmmyy10.;
format rfstdtc ddmmyy10.;
cards;
101 26/10/2018
102 26/10/2018
103 27/10/2018
;
run;
proc sort data=VS;
by ptid;
run;
proc sort data=DM;
by ptid;
run;
data VS1;
merge VS DM;
by ptid;
run;
proc print;
run;
DATA VS2 VS3;
set VS1;
if vsdtc < rfstdtc then output VS2;
if vsdtc > rfstdtc then output VS3;
run;
DATA NEWL;
SET VS2;
IF LAST.result THEN vsblfl = 'Y';
RUN;
PROC PRINT;
RUN
Please avoid coding in upper case, its shouting code. Missing by line:
data newl; set vs2; by result; if last.result then vsblfl='Y'; run;
What is the error?
Please avoid coding in upper case, its shouting code. Missing by line:
data newl; set vs2; by result; if last.result then vsblfl='Y'; run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: