I am trying to update a table in SAS with a new variable. I want the salary column to be multiplied by different numbers depending on position. This is the code I have been using, but it giving me an error saying that modsal isn't a variable and also giving an error when I am trying to set the position to the number I am multiplying by saying there is a syntax error.
PROC sql;
UPDATE work.baseball2
SET modsal = salary*case label ="Modern Salary Equivelent"
WHEN position = 'C' then 5
WHEN position = ('1B','2B','SS','3B') then 6
WHEN position = ('RF','LF','CF','DH') then 8
END;
this part definitely needs correction
to
WHEN position = 'C' then 5
WHEN position in ('1B','2B','SS','3B') then 6
WHEN position in ('RF','LF','CF','DH') then 8
this part definitely needs correction
to
WHEN position = 'C' then 5
WHEN position in ('1B','2B','SS','3B') then 6
WHEN position in ('RF','LF','CF','DH') then 8
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.