BookmarkSubscribeRSS Feed
Q1983
Lapis Lazuli | Level 10

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????

1 REPLY 1
noling
SAS Employee

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

SAS Innovate 2025: Call for Content

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!

Submit your idea!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 314 views
  • 2 likes
  • 2 in conversation