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: proc format; value BMIcatf 1='normal' 2='overweight' 3= 'obese'; run; data final; set totalcohort; weight_kg = (weight / 2.205); height_m = (height * 0.0254); BMI = (weight_kg) / (height_m **2); *should we have to square the value for correct BMI?*; if BMI >=19; if BMI <25 then BMIcat = 1; else if BMI >= 25 and BMI < 30 then BMIcat = 2; else BMIcat = 3; BMI1 = BMI < 25; BMI2 = BMI >= 25 and BMI <30; BMI3 = BMI >=30; waist_hip_ratio = (waist / hip); meanSBP = (bp_1s + bp_2s) / 2; log_glyhb = log(glyhb); if gender = 'male' then male =1; else male = 0; format BMIcat BMIcatf.; run;
... View more