I am trying to make a filter in SAS EG using the Filter Data tab and the prompt date. I get the error below. Not sure why.
1 ;*';*";*/;quit;run;
2 OPTIONS PAGENO=MIN;
3 %LET DateRange_max = 31Dec2022;
4 %LET DateRange_min_label = November 01, 2021;
5 %LET DateRange_min = 01Nov2021;
6 %LET DateRange_max_label = December 31, 2022;
7 PROC SQL NOEXEC;
8 SELECT t2.CIN,
9 t2.Month,
10 t2.Year,
11 t2.DATE,
12 /* October */
13 (Month( intnx('month', "&DateRange_min"d, 11, 'end'))) FORMAT=Z2. AS October,
14 t2.Age_Group,
15 t2.Elig
16 FROM WORK.NO_DUP t2
17 WHERE t2.DATE BETWEEN &DateRange_min AND &DateRange_max;
NOTE: Line generated by the macro variable "DATERANGE_MIN".
17 01Nov2021
_______
22
76
ERROR 22-322: Syntax error, expecting one of the following: !!, *, **, +, -, /, AND, ||.
ERROR 76-322: Syntax error, statement will be ignored.
18 QUIT;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
19 %SYMDEL DateRange_max_label;
20 %SYMDEL DateRange_min_label;
21 %SYMDEL DateRange_min;
22 %SYMDEL DateRange_max;
23
24 QUIT; RUN;
Found why it wasn't working. I did not check off "Generate filter for a prompt value". Now it is working! 😀
Found why it wasn't working. I did not check off "Generate filter for a prompt value". Now it is working! 😀
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.