BookmarkSubscribeRSS Feed
SASPhile
Quartz | Level 8

 

SubjectIDTest_NameDateCollection_TimeResult_ValueResult_Units
123456Height6/8/2010NA1.53m
123456Height6/22/2010NA1.51m
123456HeightNANA1.51m
123456Weight6/8/2010NA63kg
123456Weight6/22/2010NA62kg
123456WeightNANA61kg
123456WeightNANA61kg
456789Height8/12/2010NA1.36m
456789HeightNANA1.36m
456789Height7/30/2010NA1.36m
456789Weight8/12/2010NA36kg
456789WeightNANA36kg
456789Weight7/30/2010NA36kg

 

Now if height is missing in all visits, then BMI is blank
if height is missing in one of the visits, take height from previous visits(from the last visit ordered by visit date)
if weight is missing in one of the visits, leave BMI blank

 

 

5 REPLIES 5
PaigeMiller
Diamond | Level 26

BMI is not present in this data set. Please explain further what you want to do and provide lots of details so we can understand your problem.

--
Paige Miller
SASPhile
Quartz | Level 8

need to derive BMI. using below formula

BMI = Weight/(Height * Height)

lakshmi_74
Quartz | Level 8
data want(drop=new_bmi_height);
set have;
by subjectid date; retain bmi new_bmi_height;
if first.subjectid then do; bmi=0; new_bmi_height=0; end;
if missing(result_value) then
do;
if upper(test_name) eq 'HEIGHT' then bmi=new_bmi_height;
else if upper(test_name) eq 'WEIGHT' then bmi=0;
end;
else
do;
if upper(test_name) eq 'HEIGHT' then
do; bmi=/*Calculate BMI Value */; new_bmi_height=bmi; end;
else if upper(test_name) eq 'WEIGHT' then bmi=result_value;
end;
output;
run;
SASPhile
Quartz | Level 8

result_value is not BMI. it is actually weight and height values

lakshmi_74
Quartz | Level 8
You can upgrade easily how do you wish.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 833 views
  • 0 likes
  • 3 in conversation