Dear community,
I don't understand why I have this error message when I want to run my macro.
Could you help me please ?
What @Reeza & @PaigeMiller said, everything looks like it should work. This leads me to think something earlier in your SAS session is causing the issue and SAS is only figuring that out at this point.
I'd start by restarting your SAS session, and try running only this macro
That's line 706 - I think the actual issue is before that line making it invalid - a missing semicolon or something perhaps???
Try creating the macro in a separate program/session and see if that still generates an error.
Made a small example that shows your macro name/calling isn't the issue:
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
68
69 %macro com (com, year);
70
71 %put &com.;
72 %put &year.;
73
74 %mend;
75
76 %com(25, 2014);
25
2014
@Rodrigue wrote:
Dear community,
I don't understand why I have this error message when I want to run my macro.
Could you help me please ?
Perhaps there is an error earlier in your code (like a missing semi-colon or something similar). Show us more of the log before you get to %macro com
What @Reeza & @PaigeMiller said, everything looks like it should work. This leads me to think something earlier in your SAS session is causing the issue and SAS is only figuring that out at this point.
I'd start by restarting your SAS session, and try running only this macro
If @Tom is right about invisible characters, that's a great catch.
And, @Rodrigue , this is why we always ask for you to provide the log as text (pasted into the window that appears when you click on the </> icon) and not a screen capture. In the future, we shall expect the log as text, not a screen capture.
Delete that invisible character between the M and (. You might also want to replace the space between macro and com.
To recreate the issue create a macro definition like this:
%macro comX(a,b);
%put &=a &=b ;
%mend ;
%comX(one,two);
Then use change command to change the X into an invisible character, like the hex code 'A0'x that some systems use as meaning non-breaking space.
change X 'A0'x all
And submit that code:
50 %macro com (a,b); ERROR: The SAS Macro Facility is unable to write the macro 'COM 'n to the macro library. ERROR: The value COM is not a valid SAS name. 51 %put &=a &=b ; 52 %mend ; 53 %com (one,two); - 180 ERROR: The value COM is not a valid SAS name. WARNING: Apparent invocation of macro COM not resolved. ERROR 180-322: Statement is not valid or it is used out of proper order.
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.