BookmarkSubscribeRSS Feed
nikhilbajaj
Calcite | Level 5

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.

2 REPLIES 2
Peter_C
Rhodochrosite | Level 12

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

you could concatenate the columns OFFRG_N and CRT_TS

Ksharp
Super User

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')

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