- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Dear community,
I don't understand why I have this error message when I want to run my macro.
Could you help me please ?
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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 ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Please don't post it as images.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.