I have a ringing situation, because I created a column with case when, but after run it shows that all fields are empty, but if I create a query with one of the conditions, it shows the results. The same in Excel, when it will generate a SAS file, it shows that there are empty fields, but when I created a pivot table, it shows me the results.
What could it be caused by ?
My code :
proc sql; create table kredyty as select *, case when (DEF_PREV_MONTH) = '0' and (spr_DEFAULT) = '1' then '1' when (DEF_PREV_MONTH) = '1' and (spr_DEFAULT) = '1' then '0' end as NEW_DEFAULT from kredyty as a left join (select spr_NRB, DEF_PREV_MONTH from NewDef) as b on a.spr_NRB = b.spr_NRB ; quit;
I note that you do not have any ELSE clause on your CASE statement.
This means that if spr_DEFAULT is anything other than '1', you will get a missing (blank) value, and if DEF_PREV_MONTH is not '1' or '0' you will also get a blank value.
That is probably what happens; but unless you can share some actual data (as datastep code, please), it is hard to say where things go wrong.
I note that you do not have any ELSE clause on your CASE statement.
This means that if spr_DEFAULT is anything other than '1', you will get a missing (blank) value, and if DEF_PREV_MONTH is not '1' or '0' you will also get a blank value.
That is probably what happens; but unless you can share some actual data (as datastep code, please), it is hard to say where things go wrong.
Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.
Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.
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.
Ready to level-up your skills? Choose your own adventure.