Help using Base SAS procedures

sql error

Reply
N/A
Posts: 0

sql error

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
Regular Contributor
Posts: 165

Re: sql error

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.).
Regular Contributor
Posts: 171

Re: sql error

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]
Ask a Question
Discussion stats
  • 2 replies
  • 134 views
  • 0 likes
  • 3 in conversation