Hello
I am trying to insert data into my table using the case-when statement, however I am getting a syntax error.
Here's what I am trying to do:
proc sql;
insert into temp1 (x,y,z)
values(
case when condition 1 then a
when condition 2 then b
else c
end as x,
case when condition 3 then c
when condition 4 then d
else e
end as y,
case when condition 5 then f
when condition 6 then g
else g
end as z)
run;
Thank you.
This looks like pseudo code. Also, why don't you share the log/error message?
You can't expect us to help you if don't give us the means to do it.
Where is the data involved in the different conditions?
Nearly 200 sessions are now available on demand in the Innovate Hub.
Watch Now →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.