BookmarkSubscribeRSS Feed
bhca60
Quartz | Level 8

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 ).
5 REPLIES 5
Tom
Super User Tom
Super User

I would try doing what the error message says and add in the closing parenthesis required when using the IN operator.

bhca60
Quartz | Level 8
There were parentheses on it but i thin becuase its separates by a semi-colon it's not reading it.
Tom
Super User Tom
Super User

@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')
Kurt_Bremser
Super User

 


@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.

PaigeMiller
Diamond | Level 26
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');

  

--
Paige Miller

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

Explore Now →
Creating Custom Steps in SAS Studio

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1983 views
  • 2 likes
  • 4 in conversation