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
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.