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]

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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.

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