Hi all,
I am trying to collapse the levels of my categorical variable Readto_1617 from 4 to 3 levels.
These are the current levels. I must say, my current level when it comes to SAS is a beginner
value read /*readto_1617*/
1 = "0 days"
2 = "1-3 days"
3 = "4-6 days"
4 = "Every day"
I want to combine 1= "0 days" and 2="1-3 days" such that my levels will now be
1 = "0 -3 days"
2 = "4-6 days"
3 = "Every day"
Below was how it was formatted
proc format;
value read /*readto_1617*/
1 = "0 days"
2 = "1-3 days"
3 = "4-6 days"
4 = "Every day";
run;
How do I change it to 3 levels? Thanks for the anticipated help
Hi microdire27,
Here is how you can change it to 3 levels:
proc format;
value read
1,2 = "0 -3 days"
3 = "4-6 days"
4 = "Every day";
run;
Hope this helps.
You talk about collapsing levels, which in this case has nothing to do with formats. It has to do with your data, which you need to show us (a portion of). We need to see the days.
I asked for a "portion of" your data, and the variable that contains days.
Anyway, perhaps you could just show us the (portion of) code that turns the days into 0, 1, 2, ... You can paste it right into your message by clicking on the "running man" icon and pasting it into the window that appears.
Hi microdire27,
Here is how you can change it to 3 levels:
proc format;
value read
1,2 = "0 -3 days"
3 = "4-6 days"
4 = "Every day";
run;
Hope this helps.
It works. Thank you so much.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.