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.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 740 views
  • 1 like
  • 4 in conversation