I have a column with some unwanted data “XX” and want to set them as 0. Otherwise, keep the column’s data as it is. Something similar to if columnA = “XX” then 0 Else columnA. I tried doing this using a proc SQL SAS step, but that did not work. So looking for the most efficient way of doing using SAS SQL. Thanks for any help.
x
if columnA = "XX" then 0
Else columnA
End as columnA
Advertisement
Answer
It’s a CASE statement in SQL.
Case when columnA='XX' then '0'
else columnA
end as ColumnA_New
original code: Case when columnA=’XX’ then 0 else columnA end as ColumnA