Hi all,
I am completing an assignment that involves constructing new variables in my code I am supposed to:
1. create a formula for BMI
2. compute a Categorical BMI variable in which 1=normal (<25) , 2=overweight (25 to <30) and 3=obese
3. three piecewise variables for the BMI intervals as defined in the Categorical BMI.
My question is, does my code satisfy the piecewise variables? In our lecture, there are a lot of long and drawn out ways to create piecewise variables but I want to ensure this is being done correctly for analysis. Here is my code:
> 3. three piecewise variables for the BMI intervals
You have constructed one categorical variable (BMIcat), which has the values 1,2,3.
You have created three binary indicator variables (often called "dummy variables"), which you have named BMI1, BMI2, and BMI3.
I don't know how your instructor defines a "piecewise variable." If you use that term to mean a binary indicator variable, then this looks fine. If it means something else, we need to know the definition.
I would delete the line
if BMI >=19;
unless you purposely want to exclude underweight people.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for 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.