Help using Base SAS procedures

error on comparing two columns together

Reply
Occasional Contributor
Posts: 13

error on comparing two columns together

Hi,

I want to compare two columns together using the highlighted syntax but SAS is not allowing me to do that. Is there an alternative for this?

select distinct A.OFFRG_N,

A.CRT_TS,

case when (A.OFFRG_N, A.CRT_TS) in 

(select OFFRG_N, CRT_TS from CSTST231_PMRINSD

where BUSN_TY_SEG_C = 'New' or BURN_TY_SEG_C = 'Renl')

then A.PMR_BK_D

else NULL

end as PMR_BK_D

from CSTST231_PMRINSD A, CCTRP101_OFF_TERM B

where A.OFFRG_N = B.OFFRG_N

and A.CRT_TS = put(B.OFFRG_TM_CRT_TS,datetime26.)

log -

 

108 rsubmit;

NOTE: Remote submit to MYNODE commencing.

 

969 proc sql;

970 create table TEST_RESULT as

971 select distinct A.OFFRG_N,

972 A.CRT_TS,

973 case when (A.OFFRG_N, A.CRT_TS) in

-

22

76

ERROR 22-322: Syntax error, expecting one of the following: !, !!, &, ), *, **, +, -, /, <, <=,

<>, =, >, >=, ?, AND, BETWEEN, CONTAINS, EQ, EQT, GE, GET, GT, GTT, IN, IS, LE,

LET, LIKE, LT, LTT, NE, NET, NOT, NOTIN, OR, ^, ^=, |, ||, ~, ~=.

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

974 (select OFFRG_N, CRT_TS from CSTST231_PMRINSD

975 where BUSN_TY_SEG_C = 'New' or BURN_TY_SEG_C = 'Renl')

976 then A.PMR_BK_D

977 else NULL

978 end as PMR_BK_D

979 from CSTST231_PMRINSD A, CCTRP101_OFF_TERM B

980 where A.OFFRG_N = B.OFFRG_N

981 and A.CRT_TS = put(B.OFFRG_TM_CRT_TS,datetime26.)

NOTE: Remote submit to MYNODE complete.

Valued Guide
Posts: 2,177

Re: error on comparing two columns together

Posted in reply to nikhilbajaj

It is a syntax style that teradata supports but sas does not.

you could concatenate the columns OFFRG_N and CRT_TS

Super User
Posts: 10,044

Re: error on comparing two columns together

Posted in reply to nikhilbajaj

Try :

case when CATS(A.OFFRG_N, A.CRT_TS) in

(select CATS(OFFRG_N, CRT_TS) from CSTST231_PMRINSD

where BUSN_TY_SEG_C = 'New' or BURN_TY_SEG_C = 'Renl')

Ask a Question
Discussion stats
  • 2 replies
  • 189 views
  • 0 likes
  • 3 in conversation