Hello,
Currently, I have a document that drops that imports into SAS and sometimes one of the columns is blank, and other times it is not. I am trying to use Proc Sql to edit the whole table in one swoop. The issue is, case - when does not work because the values are different when the import is blank. I was wanting to see if anyone had recommendations. currently, my import can sometimes look like:
Name
Date
Answered
Total
Someone
1/19/2022
30
or like:
Name
Date
Answered
Total
Someone
1/19/2022
10
30
The Proc SQL i was trying to use was
Proc Sql;
Create Table Want as
select datepart('Date'n) as Date1 format = mmddyy10.
,Name as Source
,case
When Answered is Null then input("0",best.)
When Answered is not Null then Answered
end as Answered1
,case
When Total is Null then input("0",best.)
When Total is not Null then Total
end as Totals
From Have
;
This pull only works if the 2nd type of table is dropped for the import but if the 1st type is, the error I receive is:
ERROR: Result of WHEN clause 2 is not the same data type as the preceding results.
Please help. I have tried CAST but it is not working for me.
... View more