
By unusable, do you get an error in making the calculation? BMI should be float as you will normally want at least one decimal place unless you are simply looking at cut points. Are height and weight integers?
In Analysis you can do this several ways. What follows is for metric measurements.
1. height and weight are integers (m and kg, respectively): gen bmi = float(weight)/(float(height)^2)
2. height and weight are float: gen bmi=weight/(height^2)
3. you want bmi as integer gen i bmi = integer(float(weight)/(float(height)^2))
4. you want categories, e.g. WHO classification: define bmicat ______________ define bmi ###.## bmi = round(weight/(height^2),2) recode bmi to bmicat low-18.49 = "Underweight" 18.5 - 24.99 = "Normal" 25 - 29.99 = "Overweight" 30 - high = "Obese"
Be certain to use the ROUND function so that bmi such as 24.996 do not get lost in the recode. If you want a calculated bmi of 29.996 to be "Normal", then you'll have to be careful with the calculation and the recode.
Now, to use feet, inches and pounds, the approach is:
gen bmi = 703*float(weight)/(float(htfeet*12+htinch))^2
If you get the error "Data type mismatch", be sure to use float to turn integers into floating point variables.
If you want to do this in EpiData Entry (not sure why you would), check the help files for CHECK commands as the functions may differ.
Jamie
On 2010-10-13, at 9:30 AM, epidata-list@lists.umanitoba.ca wrote:
I am having trouble calculating BMI in Epidata. Height is measured in feet (separate) and inches (separate). I tried to create a new variable (BMI), which it did, but it is labelled as "Float," and unusable. Please help!
Ali