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 value | Formattade displayed value | Default |
upcase(Name) = 'ALFRED' or upcase(SEX) = 'F' | Alfred + girls | * |
upcase(Name) = 'ALFRED' | Alfred |
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;
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;
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.