BookmarkSubscribeRSS Feed
trochlil
Calcite | Level 5

Hello,

   I have a program that runs a macro within a macro. I have a do loop that executes and gives a variable, awvar, to plug into the macro. The macro then is trying to compare two files from consecutive years, and so merges the two years, but relabels one variable set so that they are not overwritten. However, no matter what the variable is after the variable awvar the log reports the error "Expecting a =." and the refuses to execute the rest of the rename statement. Has this ever happened to anyone else? It doesn't make any sense becuase when I enter the variables manually, the code runs fine. 

 

An example of what I am trying to say is attached. This is SAS version 9.3.

 

Thank you so much!

6 REPLIES 6
Reeza
Super User

How are you executing these macro's overall? Batch or %include?

 

Otherwise it's likely you have an error in your code somewhere but I can't see it given what you've provided. 

 

To debug, delete all code and add back proc by proc until you get the error. 

 

 

trochlil
Calcite | Level 5
Thanks very much for your reply!

I am using %include. And I don't think I can run proc by proc, because it
only doesn't work when I use the do loop. When I do it manually it works.
Or is there a way to step through a do loop?



##- Please type your reply above this line. Simple formatting, no
attachments. -##
Reeza
Super User

Try adding the LRECL option after your %include.

 

%include 'myfile.sas' /lrecl=500;
trochlil
Calcite | Level 5

No luck, unfortunately.

Reeza
Super User

Well given the very little you've provided I can't help beyond this. We can't even see the full do loop.

trochlil
Calcite | Level 5

I've edited the post to include the two programs. The overall program is the rim.agency.sas, which calls the awf_switchers_service program.The relevant do loop is from lines 421-454, and the error occurs during the execution of the macro awf_switchers_service. Please let me know if there's any other information that would be helpful.

 

Thanks!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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