BookmarkSubscribeRSS Feed
drawerder
Calcite | Level 5

Hello, Am trying to do a new computed column by advanced expression after doing an outer join:  

 

" case when t1.'Claim No'n = "" then t2.'Claim No'n else t1.'Claim No'n end " where am asking it to find the value from the first table and if it is blank then take it from the second table.

 

The thing is it works for variable types that are string, once i tried to use it for Dates or numbers it gave the error message:

 

ERROR: Expression using equals (=) has components that are of different data types

 

Please Advice, thanks 

4 REPLIES 4
SASKiwi
PROC Star

Try a dot instead of quotes - dot is a missing numeric constant, quotes mean a missing character constant:

case when t1.'Claim No'n = .
drawerder
Calcite | Level 5

Dear SASKIWI, 

 

Thanks for your reply, it worked fine with the numeric type. can u advise on what should i use for a date instead of the ( " " or . )

 

regards,

SASKiwi
PROC Star

Dates in SAS are stored as numbers - the number of days after 1 Jan 1960. So a dot works equally well as a constant for checking missing dates.

FredrikE
Rhodochrosite | Level 12

I have begun to use function missing() instead:

 

 case when missing(t1.'Claim No'n) then t2.'Claim No'n else t1.'Claim No'n end 

 

//Fredrik

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

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 4 replies
  • 1306 views
  • 0 likes
  • 3 in conversation