BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi Friends,

I am new to SAS programming..I am getting an error on the below code..

PROC IMPORT OUT = types
DATAFILE= "&drv2\types.CSV"
REPLACE;
RUN;

data testout;
set test;
if (expdat>today() or expdat=.) and stat ='IN'
and (typ in (Select typ from types));
keep lobcod typ;
run;

Error:
(typ in (Select typ from types));
------
22
76
ERROR 22-322: Syntax error, expecting one of the following: a quoted string,
a numeric constant, a datetime constant, a missing value,
iterator, (.

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

Please help me to resolve this issue.

Thanks in advance.
Raj
2 REPLIES 2
RickM
Fluorite | Level 6
You are mixing the data step and proc sql code. When using "data testout; set test..." you cannot use the proc sql type statements (select from, left join, etc.).
polingjw
Quartz | Level 8
Just use proc sql instead of the data step. [pre]
proc sql;
create table testout as
select lobcod, typ
from test
where (expdat>today() or expdat=.) and stat ='IN'
and (typ in (Select typ from types));
quit;[/pre]

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 2 replies
  • 1157 views
  • 0 likes
  • 3 in conversation