I have a computed column (PUTMONTHTEST) that is the basis for a prompt (Prompt_3) asking the user for the month (i.e. November) to use in a filter, but it results in a NOTE and and ERROR (see code). I've produced all code using GUIs and tried a number of things to resolve/understand what's going on but I need some help.
;*';*";*/;quit;run;
OPTIONS PAGENO=MIN;
%LET Prompt_1 = DEPT1;
%LET Prompt_10 = 3;
%LET Prompt_11 = DEPT1;
%LET Prompt_12 = DEPT2;
%LET Prompt_13 = DEPT3;
%LET Prompt_1_count = 3;
%LET Prompt_3 = November;
PROC SQL NOEXEC;
SELECT t1.COLUMN_1,
t1.COLUMN_2,
t1.DATE_1,
t1.PUTMONTH,
FROM WORK.APPEND_TABLE_0000 t1
WHERE %_eg_WhereParam( t1.COLUMN_1, Prompt_1, IN, TYPE=S, IS_EXPLICIT=0 ) AND %_eg_WhereParam(
t1.PUTMONTH, Prompt_3, IN, TYPE=S, IS_EXPLICIT=0 )
NOTE: Line generated by the macro function "UNQUOTE".
"November"
ERROR 22-322: Syntax error, expecting one of the following: (, SELECT.
ERROR 76-322: Syntax error, statement will be ignored.
ORDER BY t1.COLUMN_1;
QUIT;
%SYMDEL Prompt_1;
%SYMDEL Prompt_10;
%SYMDEL Prompt_11;
%SYMDEL Prompt_12;
%SYMDEL Prompt_13;
%SYMDEL Prompt_1_count;
%SYMDEL Prompt_3;
QUIT; RUN;
As a workaround, I figured out that if I change the "Number of values:" field, on the Prompt Type and Values tab of the Edit Prompt window, to "Multiple values", rather than "Single value", then I don't receive the syntax error. For my purposes this is an acceptable fix since I don't need to limit the user to a single value. However, why this error exists for "signal value" prompt types still needs to be resolved.
Hi,
I see the error in the SQL
There must not be ',' after t1.PUTMONTH
Kind regards
Natalja
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.