Derivation
variable: height (table[s]: this dataset)
variable: weight (table[s]: this dataset)
variable: resval (table[s]: this dataset)
variable: sex (table[s]: this dataset)
variable: dropped_R (table[s]: this dataset)
gen ffmass_R=-10.68+(0.65*(height^2/resval))+(0.26*weight)+(0.02*resval) if sex==0 & height~=. & weight~=. & resval~=. //male
replace ffmass_R=-9.53+(0.69*(height^2/resval))+(0.17*weight)+(0.02*resval) if sex==1 & height~=. & weight~=. & resval~=. //female
<remove inconsistent data from combined data:>
foreach var in fatmass_R fatmasspc_R ffmass_R ffmasspc_R {
replace `var'=. if dropped_R==1
}