@Rose2 wrote:
I attempted
if new_dt_categories in ('Moderate Distress', 'High‎/Extreme Distress') then new_dt_cat2= 'Moderate/Extreme';
else new_dt_categories2=new_dt_categories;
run;
but when I did proc freq, it still had separate categories, and now they were numbered instead of being named in the table.
What you described makes it sound like your original variable is numeric (or if character has digit strings in it) and is being displayed using a user defined format that converts those numbers into the text you used in IF statement.
Try using PUT() in your IF. Or even easier use VVALUE() function since then you don't need to know what format is attached to the variable. Also make sure to define the new variable long enough to hold the longest possible value.
length new_dt_cat2 $200;
if vvalue(new_dt_categories) in ('Moderate Distress', 'High‎/Extreme Distress') then new_dt_cat2= 'Moderate/Extreme';
else new_dt_categories2=vvalue(new_dt_categories);
Note you could also just make a new format that collapses those categories into one. That might be enough for what you are doing.