%Let Reporting_Period = %sysfunc(Today());
%Macro REPMTH(Day=&Reporting_Period);
%IF &day = %sysfunc(Intnx(Month,&Day,0,b)) %THEN %DO;
%sysfunc(Intnx(Month,&Day,-2,s),MMYYN4.);
%END;
%ELSE %DO;
%sysfunc(Intnx(Month,&Day,-1,s),MMYYN4.);
%END;
%Mend;
%LET Today = %sysfunc(putn(&Reporting_Period,ddmmyyn2.));
%Macro MonthlyFile(date=&Today);
%IF &date < 3 %THEN %DO;
T
%END;
%IF &date < 7 %THEN %DO;
%END;
%IF &date < 9 %THEN %DO;
A
%END;
%IF &date < 32 %THEN %DO;
F
%END;
%Mend;
%put NOTE: &reporting_period;
%put NOTE: %sysfunc(putn(&reporting_period,ddmmyy10.));
%put NOTE: &today;
%put NOTE: %Repmth();
%put NOTE: %monthlyfile();
%put NOTE: %Repmth()%monthlyfile();
Hi guys,
Need help on my last part, why i cant write a result of 1223F?
I got an error says :Statement is not valid or it is used out of proper order.
Your first macro is emitting a semicolon.
If does not impact your first usages since running code like:
%put xxx;;
Just results in an extra empty statement.
But running code like:
%put 1233;F;
Is invalid.
PS If you want the day of the month just use the DAY() function.
%LET Today = %sysfunc(day(&Reporting_Period),z2.);
Your first macro is emitting a semicolon.
If does not impact your first usages since running code like:
%put xxx;;
Just results in an extra empty statement.
But running code like:
%put 1233;F;
Is invalid.
PS If you want the day of the month just use the DAY() function.
%LET Today = %sysfunc(day(&Reporting_Period),z2.);
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 25. 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.