BookmarkSubscribeRSS Feed
scb
Obsidian | Level 7 scb
Obsidian | Level 7

When I run the below code, I got the error message, anyone can help? Thanks.

 

proc datasets lib=TEST;
audit WANT;
initiate;
USER_VAR _REASON_CHANGE_ $30;
quit;

 


DATA TEST.WANT;
MODIFY TEST.WANT;
WHERE NO IN (SELECT DISTINCT OLD_NO FROM REFERRAL);
REFERRAL="N";
_REASON_CHANGE_ = "Refer Case";
RUN;

 

ERROR: Syntax error while parsing WHERE clause.
ERROR 22-322: Syntax error, expecting one of the following: a quoted string,
a numeric constant, a datetime constant, a missing value, -.

ERROR 76-322: Syntax error, statement will be ignored.

2 REPLIES 2
Kurt_Bremser
Super User

select is only valid in proc sql, not in a data step.

You might want to use a data step merge to find the observations that need to be changed.

Please supply example data (in data steps with datalines) to work with.

ChrisBrooks
Ammonite | Level 13

You're trying to mix data step code with SQL i.e. SELECT DISTINCT OLD_NO FROM REFERRAL is SQL and the rest is data step. They're two completely different (albeit SAS supported) languages.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

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
  • 686 views
  • 0 likes
  • 3 in conversation