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

%macro createGradRetRowsSummaryLines(stud_type, cohortYearCount, cohortYearCount2, gradOrRen, retOrGrad, firstTime);
if cohort=201510 and DisplayColumn="&cohortYearCount2 Year &gradOrRen of &stud_type" then _2014_15b=&retOrGrad._percent;
%mend;

 

Why is Enterprise Guide throwing an error when I use &retOrGrad._percent should it read this as variable || _percent and query the variable name that matches the concatenation?

 

ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant, a missing value, INPUT, PUT.

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

Has the value in the macro variable been macro quoted?

Perhaps that is causing the parser to see that as two tokens.

Try adding %UNQUOTE() function.

_2014_15b=%unquote(&retOrGrad._percent)

View solution in original post

3 REPLIES 3
PaigeMiller
Diamond | Level 26

Please re-run your code with OPTIONS MPRINT; as the first line of the program.

 

Show us the full SAS log, not just the error messages. Paste the log into the window that appears when the you click on the {i} icon (do not paste your log directly into your reply)

--
Paige Miller
Tom
Super User Tom
Super User

Has the value in the macro variable been macro quoted?

Perhaps that is causing the parser to see that as two tokens.

Try adding %UNQUOTE() function.

_2014_15b=%unquote(&retOrGrad._percent)
ballardw
Super User

@DavidPhillips2 wrote:

%macro createGradRetRowsSummaryLines(stud_type, cohortYearCount, cohortYearCount2, gradOrRen, retOrGrad, firstTime);
if cohort=201510 and DisplayColumn="&cohortYearCount2 Year &gradOrRen of &stud_type" then _2014_15b=&retOrGrad._percent;
%mend;

 

Why is Enterprise Guide throwing an error when I use &retOrGrad._percent should it read this as variable || _percent and query the variable name that matches the concatenation?

 

ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant, a missing value, INPUT, PUT.


You don't even show the code used to call the macro. So we don't see what possible values your macro variable might have.

 

My guess is that something in &retorgrad is not valid in a SAS variable name or the length of the result exceeds 32 characters and is not a valid variable name after the concatenation.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 3 replies
  • 633 views
  • 1 like
  • 4 in conversation