Hello,
I am doing some work on a dataset looking at infectious disease outcomes and their relationship to socioeconomic variables. I have a continuous "number of people in the household outcome" that I am trying to turn into a dichotomous variable (greater than 5 and less than or equal to 5). The variable currently ranges from 2-16. How can I go about coding this?
Thanks so much for your help!
If I understand you, you want a dummy variable that is true (or 1) if the household is > 5, else it should be 0 (or false).
This is one simple way to calculate this. Note it doesn't take into account what should happen if the continuous variable has a missing value.
data want;
set have;
length is_household_gt_5 8;
/* assuming household_size is continuous */
is_household_gt_5 = (houshold_size > 5);
run;
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 lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.