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

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

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
  • 800 views
  • 0 likes
  • 2 in conversation