data test1;
date1="1jun2019"d;
date2="1may2016"d;
date3="1apr2018"d;
tran_dt="15nov2018"d;
format date1 date2 date3 tran_dt mmddyy10.;
run;
data test2;
set test1;
if coalesce(date1,date2,date3) <=tran_dt;
run;
data test3;
date1="1jun2016"d;
date2="1may2018"d;
date3="1apr2019"d;
tran_dt="15nov2018"d;
format date1 date2 date3 tran_dt mmddyy10.;
run;
data test4;
set test1;
if coalesce(date1,date2,date3) <=tran_dt;
run;
%macro eof(report,cnt);
data &report.;
if eof then output;
modify &report. end=eof;
cnt=1;
run;
%mend;
%eof(test2,cnt);
%eof(test4,cnt);
Test2 and 4 are the final datasets in this script. I want to add cnt=1 to each datset. I have about 20 in my program but just showing 2 for discussion. I tried the macro seen here however I get no records. Any ideas????
What exactly are you trying to do? Do you want to add a new variable that's equal to 1 for every record in these tables? Do you want only the last record?
Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF
View now: on-demand content for SAS users
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.
Ready to level-up your skills? Choose your own adventure.