%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.);
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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: