BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Rodrigue
Obsidian | Level 7

Dear community,

 

I don't understand why I have this error message when I want to run my macro.

Could you help me please ?

Capture d’écran 2021-10-08 à 18.08.59.png

 

Capture d’écran 2021-10-08 à 18.07.14.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
AMSAS
SAS Super FREQ

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

View solution in original post

7 REPLIES 7
Reeza
Super User

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 ?

Capture d’écran 2021-10-08 à 18.08.59.png

 

Capture d’écran 2021-10-08 à 18.07.14.png

 


 

PaigeMiller
Diamond | Level 26

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
AMSAS
SAS Super FREQ

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

Rodrigue
Obsidian | Level 7

Capture d’écran 2021-10-08 à 18.22.08.pngCapture d’écran 2021-10-08 à 18.23.10.png

Reeza
Super User
The log as text would be more helpful.
Please don't post it as images.
PaigeMiller
Diamond | Level 26

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
Tom
Super User Tom
Super User

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.

 

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
  • 7 replies
  • 1644 views
  • 3 likes
  • 5 in conversation