REMOVE the VALUE keyword from the ELSE clause of your CASE.
Use valid boolean logic in the WHEN clauses
case
when amtspent > 100 then "below 100"
when 100<= amtspent <=200 then "between100 to 200"
when amtspent > 200 then "above 200"
else "nothing"
end
REMOVE the extra semi-colons in the middle of your CREATE statement.
Give your new variable that the CASE is generating a name.
ADD a FROM clause so SQL knows what you are selecting from.
SQL does not need RUN statement. Each statement runs immediately. Use QUIT statement to end the PROC SQL step.
proc sql;
create table new as
select
*
,case
when amtspent > 100 then "below 100"
when 100<= amtspent <=200 then "between100 to 200"
when amtspent > 200 then "above 200"
else "nothing"
end as new_var
from have
;
quit;
... View more