I need to create a new variable that categorizes survey responses (n=5 items, scored from 0-100) into three categories based on the number of responses that fall in a certain numerical range. I.e. if at least 3 scores fall into the 0-33 range, then the category in the new variable should equal L (where L means Languishing). If at least 3 scores fall into the 66-100, then the category in the new variable should equal F (where F means Flourishing). Else, new categorical variable should equal M (where M means Moderate).
The table below illustrates the type of data I'm working with.
| ID | Var1 | Var2 | Var3 | Var4 | Var5 |
| 1 | 22 | 78 | 56 | 77 | 98 |
| 2 | 12 | 0 | 22 | 55 | 63 |
| 3 | 88 | 2 | 87 | 30 | 73 |
| 4 | 14 | 9 | 55 | 87 | 45 |
| 5 | 15 | 66 | 53 | 96 | 54 |
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.