Hello,
An error massage is shown in my coding. Please correct, thanks.
198 DATA Text;
199 set Text;
200 IF result ^= '' and Source__Type in ('Nasopharyngeal swab' or 'Throat
---
79
388
200
76
200! (Oropharyngeal) swab' or 'Oral swab');
ERROR 79-322: Expecting a ).
ERROR 388-185: Expecting an arithmetic operator.
ERROR 200-322: The symbol is not recognized and will be ignored.
ERROR 76-322: Syntax error, statement will be ignored.
201 run;
DATA want;
set text;
if Result_t ^= '' and Source__Type_ in ('Nasopharyngeal swab' or 'Throat (Oropharyngeal) swab');
run;
Try this
DATA want;
set text;
if Result_t ^= '' and Source__Type_ in ('Nasopharyngeal swab', 'Throat (Oropharyngeal) swab');
run;
Try this
DATA want;
set text;
if Result_t ^= '' and Source__Type_ in ('Nasopharyngeal swab', 'Throat (Oropharyngeal) swab');
run;
Can't believe that forgot the comma!![]()
@ybz12003 wrote:
Can't believe that forgot the comma!
SAS does NOT need a comma between the items listed when using the IN operator.
proc print data=sashelp.class;
where age in (11 12)
or name in ('Alfred' 'Alice')
;
run;
Your problem is that you gave the IN operator a variable name when it wanted a list of character values.
2991 proc print data=sashelp.class;
2992 where age in (11 12)
2993 or name in ('Alfred' or 'Alice')
--
22
202
ERROR 22-322: Syntax error, expecting one of the following: a quoted string, ), ','.
ERROR 202-322: The option or parameter is not recognized and will be ignored.
2994 ;
ERROR: Syntax error while parsing WHERE clause.
2995 run;
3001 proc print data=sashelp.class;
3002 where age in (11 12)
3003 or name in ('Alfred' 123 'Alice')
---
22
200
ERROR 22-322: Syntax error, expecting one of the following: a quoted string, ), ','.
ERROR 200-322: The symbol is not recognized and will be ignored.
3004 ;
ERROR: Syntax error while parsing WHERE clause.
3005 run;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE PRINT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
3006 proc print data=sashelp.class;
3007 where age in (11 12)
3008 or name in ('Alfred' age 'Alice')
---
22
202
ERROR 22-322: Syntax error, expecting one of the following: a quoted string, ), ','.
ERROR 202-322: The option or parameter is not recognized and will be ignored.
3009 ;
ERROR: Syntax error while parsing WHERE clause.
3010 run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.