BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
ChrisWoo
Obsidian | Level 7
%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.

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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.);

View solution in original post

2 REPLIES 2
Tom
Super User Tom
Super User

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.);
ChrisWoo
Obsidian | Level 7
Ahh, i got it now, all i want just a text and that semi colon is unnecessary.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 2 replies
  • 363 views
  • 0 likes
  • 2 in conversation