03-06-2018 04:51 AM
When I run the below code, I got the error message, anyone can help? Thanks.
proc datasets lib=TEST;
USER_VAR _REASON_CHANGE_ $30;
WHERE NO IN (SELECT DISTINCT OLD_NO FROM REFERRAL);
_REASON_CHANGE_ = "Refer Case";
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.
03-06-2018 04:56 AM
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.
03-06-2018 04:57 AM
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.