I 'm trying to do this CASE statement
Case when LN_REGULAT.ACTION_TAKEN in ( 3, 7) then LN_REGULAT.ACTION_DATE else Null end 'DENIED_DATE' ,
70 Case when LN_REGULAT.ACTION_TAKEN in( 2, 4,5,8) then LN_REGULAT.ACTION_DATE else Null end 'WITHDRAWN_DATE'
, but I got an error message saying that "ERROR: The following columns were not found in the contributing tables: Null "
I then changed Null to '.', I got this error : "ERROR: Result of WHEN clause 2 is not the same data type as the preceding results."
If I was to connect to table LN_REGULAT directly from the data source, this case statement works.
but if I create the table as (select * form connection......), and then run this case statement, it doesn't work.
Could you please help?
Thanks,
Thanks for you response.
I got this error instead
ERROR: Result of WHEN clause 2 is not the same data type as the preceding results.
LN_REGULAT.ACTION_DATE is a datetime value
For your examples you can just eliminate the ELSE clause and the resulting value will be missing without you having to know whether you want numeric or character missing. You might get a note about the missing ELSE but it should work.
,case when LN_REGULAT.ACTION_TAKEN in (3,7) then LN_REGULAT.ACTION_DATE
end 'DENIED_DATE'
,case when LN_REGULAT.ACTION_TAKEN in (2,4,5,8) then LN_REGULAT.ACTION_DATE
end 'WITHDRAWN_DATE'
This also works as well. Thanks for your help.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.