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

Hi,

 

I'm quite new to EG and thought I could use generated prompts as I use macro variabels in SAS DMS. This seems however not always work. Can someone please explain why i don't succed with the code below? (I have tested both in EG 7.15 and EG 8.2) 

 

data prompttest;
set sashelp.class
(where=(&promptselection));
run;

 

Value of &promptselection: upcase(Name) = 'ALFRED' or upcase(SEX) = 'F' 

 

From log: ERROR 6-185: Missing ')' parenthesis for data set option list.

 

&Promptselection is generated with Prompt Manager. 

General tab:

Name = Promptselection,

Options ticked: "Requires a non-blank value" and "Use prompt value throughtout project".

Prompt Type and Values tab:

Prompt type = Text, Method for populating prompt = "User selects value from a static list", Number of values = "Single value",

List of values

Unformatted valueFormattade displayed valueDefault
upcase(Name) = 'ALFRED' or upcase(SEX) = 'F'Alfred + girls*
upcase(Name) = 'ALFRED'Alfred 

   

 

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hi @Multipla99,

 

Normally I don't use SAS Enterprise Guide, but I've just started a session in order to replicate your issue. The log contains the following %LET statement among other stuff SAS EG likes to add to the user's code:

%LET Promptselection = upcase(Name) = %nrstr(%')ALFRED%nrstr(%') or upcase(SEX) = %nrstr(%')F%nrstr(%');

So, SAS EG also did some (unauthorized) macro quoting and thus replaced the innocuous single quotes in your code with a bizarre triple of control characters: '011102'x. These are, of course, indigestible for the compiler later on, hence the error messages.

 

Use the %UNQUOTE function to undo the macro quoting:

data prompttest;
set sashelp.class(where=(%unquote(&promptselection)));
run;

View solution in original post

2 REPLIES 2
FreelanceReinh
Jade | Level 19

Hi @Multipla99,

 

Normally I don't use SAS Enterprise Guide, but I've just started a session in order to replicate your issue. The log contains the following %LET statement among other stuff SAS EG likes to add to the user's code:

%LET Promptselection = upcase(Name) = %nrstr(%')ALFRED%nrstr(%') or upcase(SEX) = %nrstr(%')F%nrstr(%');

So, SAS EG also did some (unauthorized) macro quoting and thus replaced the innocuous single quotes in your code with a bizarre triple of control characters: '011102'x. These are, of course, indigestible for the compiler later on, hence the error messages.

 

Use the %UNQUOTE function to undo the macro quoting:

data prompttest;
set sashelp.class(where=(%unquote(&promptselection)));
run;
Multipla99
Quartz | Level 8
FreelanceReinhard - I'm so grateful!

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!
SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 2 replies
  • 839 views
  • 1 like
  • 2 in conversation