Keep getting an error when doing WHERE clause (I tried single quotes, double quotes, semi-colons, commas - still getting errors):
23 proc sql;
24 create table PPP
25 as select
26 a.pid,
27 a.pcpNPI format=20. as pcpNPI2,
28 from TABLEf as A
29 inner join num1 as B
30 on a.pid=b.pid
31 where a.pcpNPI2 in ('444444444';
_
79
ERROR 79-322: Expecting a ).
I would try doing what the error message says and add in the closing parenthesis required when using the IN operator.
@bhca60 wrote:
There were parentheses on it but i thin becuase its separates by a semi-colon it's not reading it.
Huh? Semicolon marks the END of the STATEMENT. If you have a list of values for the IN operator you can use a space or a comma (or a combination).
where age in (10,12,13)
where age in (14 15 16)
where name in ('Alfred' 'Alice')
@bhca60 wrote:
There were parentheses on it but i thin becuase its separates by a semi-colon it's not reading it.
Then you did not post the complete log, something we request again and again and again. Please do so in the future.
where a.pcpNPI2 in ('444444444';
SAS will always report an error when you have mis-matched or un-matched parentheses. So the error message tells you that SAS is expecting a parenthesis.
Isn't this what you really want?
where a.pcpNPI2 in ('444444444');
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.