- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Try a dot instead of quotes - dot is a missing numeric constant, quotes mean a missing character constant:
case when t1.'Claim No'n = .
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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,
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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