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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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