Hello Everyone, I have a following code snippet, in which we keep adding an ELSE-IF statement whenever a new month starts. For example: once the month of June will start, a new ELSE-IF condition will be added as follows: ELSE IF &YYYYMMDD=20150531 THEN FILEDD=20150601; where: YYYYMMDD will be the previous month's end date & FILEDD is the new month (here June) start date. I want to automate it & avoid adding the ELSE IF statement manually every month. Any suggestions are welcome. Thanks in advance data _null_; call symputx('tt1',put(intnx('day',today(),-2),yymmddn8.),G); run; %macro DAILY_(YYYYMMDD); data ORCL.BASE1&YYYYMMDD; set MY_DIR.Daily_&YYYYMMDD.; IF &YYYYMMDD='20141231'd THEN FILEDD='20150101'd; else IF &YYYYMMDD='20150131'd THEN FILEDD='20150201'd; else IF &YYYYMMDD='20150228'd THEN FILEDD='20150301'd; else IF &YYYYMMDD='20150331'd THEN FILEDD='20150401'd; else IF &YYYYMMDD='20150430'd THEN FILEDD='20150501'd; ELSE FILEDD=FILEDD; %mend; %DAILY_(&tt1);
... View more