BookmarkSubscribeRSS Feed
parmis
Fluorite | Level 6

Hello SAS Users,

 

I'm trying to submit the following case when expression and I get the error message that components are of different types.

 

PROC SQL;

CREATE TABLE work.test AS SELECT * ,

CASE WHEN CLI in ('4244','6454654') THEN 'Approved'

END AS status,

case when apps in ('25','5') then 'In process'

 

 else 'other' end as req

 from work.info

 quit;

 

I appreciate your help

1 REPLY 1
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Well its either:

case when cli in (4244,6454654) then 'Approved' end as status,

Or:

case when apps in (25,5) then 'In process' else 'other' end as req

Or both.  Basically your comparing a variable of type numeric to character or vice versa.

 

If you had provided either/or - test data in the form of a datastep, the actual log output, I could be more specific.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 1 reply
  • 777 views
  • 0 likes
  • 2 in conversation