Hi! I have a dataset that has degree program names that end with the degree type. I want to create a new variable with just these variable types that are tacked on to the end of the program names (BS, BSEd, M.Ac, MS, etc.). I figured a wildcard% would work for this but it is not working like I thought it would. Here are two tests I did trying to get it to work: data Programs_With_States_IND;
set work.PROGRAMS_WITH_STATES_IND;
if Degree_Program_Name like '%BS%'
then Degree_Type = 'BS';
else if Degree_Program_Name like '%M.Ac%'
then Degree_Type = 'M.Ac';
else if Degree_Program_Name like '%MAT%'
then Degree_Type = 'MAT';
else if Degree_Program_Name like '%MA%'
then Degree_Type = 'MA';
run; proc sql;
create table prog_test as
select *, case
when Degree_Program_Name like '%BS%' then 'BS'
when Degree_Program_Name like '%MA%' then 'MA'
end as Degree_Type
from work.programs_with_states_ind;
quit; Any help would be appreciated! Thanks!
... View more