Dear Stata Member,
I am facing a problem in classifying BMI measurement as obese, overweight, normal, and underweight. and after running these logic below, there is still obs that did not match
this is a sample of my do file
//classifiying BMI as 1 "Obese" 2 "Overweight" 3 "Healthy Weight" 4 "Underweight" //
//Bmi Categ for obese children for GILRS//
gen bmicateg_female= .
replace bmicateg_female=1 if gender==2 & age ==2 & bmi >=19.5
replace bmicateg_female=1 if gender==2 & age ==3 & bmi >=18.5
replace bmicateg_female=1 if gender==2 & age ==4 & bmi >=18
replace bmicateg_female=1 if gender==2 & age ==5 & bmi >=18
replace bmicateg_female=1 if gender==2 & age ==6 & bmi >=18.5
replace bmicateg_female=1 if gender==2 & age ==7 & bmi >=19
replace bmicateg_female=1 if gender==2 & age ==8 & bmi >=20
replace bmicateg_female=1 if gender==2 & age ==9 & bmi >=21.5
replace bmicateg_female=1 if gender==2 & age ==10 & bmi >=23.0
replace bmicateg_female=1 if gender==2 & age ==11 & bmi >=25
replace bmicateg_female=1 if gender==2 & age ==12 & bmi >=26.5
replace bmicateg_female=1 if gender==2 & age ==13 & bmi >=28
replace bmicateg_female=1 if gender==2 & age ==14 & bmi >=29.5
replace bmicateg_female=1 if gender==2 & age ==15 & bmi >=30.5
replace bmicateg_female=1 if gender==2 & age ==16 & bmi >=31
replace bmicateg_female=1 if gender==2 & age ==17 & bmi >=32
replace bmicateg_female=1 if gender==2 & age ==18 & bmi >=32
replace bmicateg_female=1 if gender==2 & age ==19 & bmi >=32
//Bmi Categ for OVERIEGHT children for GILRS//
replace bmicateg_female=2 if gender==2 & age ==2 & bmi >=18 & bmi <=19.4
replace bmicateg_female=2 if gender==2 & age ==3 & bmi >=17 & bmi<=18.4
replace bmicateg_female=2 if gender==2 & age ==4 & bmi >=17 & bmi<=17.9
replace bmicateg_female=2 if gender==2 & age ==5 & bmi >=16.5 & bmi<=17.9
replace bmicateg_female=2 if gender==2 & age ==6 & bmi >=17 & bmi<=18.4
replace bmicateg_female=2 if gender==2 & age ==7 & bmi >=17 & bmi <=18.9
replace bmicateg_female=2 if gender==2 & age ==8 & bmi >=18 & bmi<=19.99
replace bmicateg_female=2 if gender==2 & age ==9 & bmi >=19 & bmi<=21.4
replace bmicateg_female=2 if gender==2 & age ==10 & bmi >=20 & bmi<=22.9
replace bmicateg_female=2 if gender==2 & age ==11 & bmi >=21 & bmi<=24.9
replace bmicateg_female=2 if gender==2 & age ==12 & bmi >=22.5 &bmi <=26.4
replace bmicateg_female=2 if gender==2 & age ==13 & bmi >=24 & bmi<=27.9
replace bmicateg_female=2 if gender==2 & age ==14 & bmi >=25 & bmi<=29.4
replace bmicateg_female=2 if gender==2 & age ==15 & bmi >=26 & bmi<=30.4
replace bmicateg_female=2 if gender==2 & age ==16 & bmi >= 27 & bmi<=30.9
replace bmicateg_female=2 if gender==2 & age ==17 & bmi >=27 & bmi<=31.9
replace bmicateg_female=2 if gender==2 & age ==18 & bmi >=27.5 & bmi<=31.9
replace bmicateg_female=2 if gender==2 & age ==19 & bmi >=27.5 & bmi <=31.9
and below is the dataex that did not match
input byte age float(height weight bmi gender bmicateg_female bmicateb_male BMI_cat)
10 120 33.1 22.98611 2 . . .
18 167 89 31.912226 1 . . .
12 140 50.8 25.91837 1 . . .
12 152 61 26.402355 2 . . .
17 159 79.4 31.406984 1 . . .
15 168 86 30.470524 2 . . .
18 166 88 31.93497 2 . . .
18 176 99 31.96023 1 . . .
17 171 92 31.46267 1 . . .
3 89 14.6 18.432016 1 . . .
3 93 16 18.499249 1 . . .
12 157 64 25.96454 1 . . .
12 158 66 26.43807 2 . . .
13 139 52 26.91372 1 . . .
3 87 14 18.496498 1 . . .
11 143 50 24.451075 1 . . .
14 139 55 28.466436 1 . . .
17 170 91 31.48789 1 . . .
12 157 65.2 26.451374 2 . . .
3 84 13 18.424038 1 . . .
15 156 74 30.40763 2 . . .
11 159 63 24.9199 2 . . .
17 154 75.7 31.91938 2 . . .
16 159 77 30.457655 1 . . .
10 140 44 22.44898 1 . . .
14 148 64.6 29.49233 2 . . .
16 165 83 30.486687 1 . . .
18 177 100 31.91931 1 . . .
18 167 89 31.912226 1 . . .
17 171 92 31.46267 1 . . .
15 156 74 30.40763 2 . . .
3 87 14 18.496498 2 . . .
3 84 13 18.424038 2 . . .
10 170 65 22.49135 1 . . .
13 135 51 27.98354 2 . . .
12 157 64 25.96454 1 . . .
14 174 86 28.405336 1 . . .
16 168 86 30.470524 1 . . .
15 160 78 30.46875 2 . . .
12 152 61 26.402355 2 . . .
17 165 87 31.955923 2 . . .
10 135 41 22.49657 1 . . .
16 156 74 30.40763 1 . . .
10 140 44 22.44898 1 . . .
13 154 64 26.986 1 . . .
18 166 88 31.93497 1 . . .
11 147 54 24.989586 2 . . .
18 164 86 31.975016 2 . . .
18 164 86 31.975016 1 . . .
16 170 88 30.449825 1 . . .
16 159 77 30.457655 1 . . .
11 140 48 24.4898 1 . . .
3 84 13 18.424038 2 . . .
12 143 54 26.40716 2 . . .
12 158 66 26.43807 2 . . .
16 164 82 30.487806 1 . . .
17 148 70 31.95763 2 . . .
11 143 50 24.451075 1 . . .
14 159 72 28.479885 1 . . .
11 153 57.2 24.43505 1 . . .
18 147 69 31.93114 2 . . .
14 144 61 29.417437 2 . . .
15 158 76 30.44384 2 . . .
10 143 46 22.49499 1 . . .
16 164 82 30.487806 1 . . .
3 96 17 18.446182 1 . . .
16 167 85 30.47797 1 . . .
15 170 85 29.41176 1 . . .
12 152 61 26.402355 2 . . .
10 155 54 22.47659 1 . . .
12 153 62 26.48554 2 . . .
13 157 68.8 27.91188 2 . . .
3 93 16 18.499249 2 . . .
16 165 83 30.486687 1 . . .
12 152 61 26.402355 2 . . .
12 152 61 26.402355 2 . . .
3 93 16 18.499249 2 . . .
11 154 58 24.456064 1 . . .
14 179 91 28.40111 1 . . .
15 160 78 30.46875 2 . . .
18 167 89 31.912226 2 . . .
10 140 44 22.44898 1 . . .
15 146 65 30.493525 2 . . .
10 146 49 22.987427 2 . . .
15 157 75 30.427197 2 . . .
16 170 88 30.449825 1 . . .
18 177 100 31.91931 1 . . .
10 130 38 22.48521 1 . . .
11 151 57 24.998903 2 . . .
11 155 60 24.97399 2 . . .
16 169 87 30.461117 1 . . .
10 140 44 22.44898 1 . . .
10 143 46 22.49499 1 . . .
16 145 65 30.915575 2 . . .
13 148 59 26.93572 1 . . .
17 170 91 31.48789 1 . . .
16 145 65 30.915575 2 . . .
12 141 52.5 26.407124 2 . . .
16 172 90 30.42185 1 . . .
17 166 88 31.93497 2 . . .
end
label values gender gn
label def gn 1 "Male", modify
label def gn 2 "Female", modify
label values BMI_cat bm1
kindly for your assistance please
I am facing a problem in classifying BMI measurement as obese, overweight, normal, and underweight. and after running these logic below, there is still obs that did not match
this is a sample of my do file
//classifiying BMI as 1 "Obese" 2 "Overweight" 3 "Healthy Weight" 4 "Underweight" //
//Bmi Categ for obese children for GILRS//
gen bmicateg_female= .
replace bmicateg_female=1 if gender==2 & age ==2 & bmi >=19.5
replace bmicateg_female=1 if gender==2 & age ==3 & bmi >=18.5
replace bmicateg_female=1 if gender==2 & age ==4 & bmi >=18
replace bmicateg_female=1 if gender==2 & age ==5 & bmi >=18
replace bmicateg_female=1 if gender==2 & age ==6 & bmi >=18.5
replace bmicateg_female=1 if gender==2 & age ==7 & bmi >=19
replace bmicateg_female=1 if gender==2 & age ==8 & bmi >=20
replace bmicateg_female=1 if gender==2 & age ==9 & bmi >=21.5
replace bmicateg_female=1 if gender==2 & age ==10 & bmi >=23.0
replace bmicateg_female=1 if gender==2 & age ==11 & bmi >=25
replace bmicateg_female=1 if gender==2 & age ==12 & bmi >=26.5
replace bmicateg_female=1 if gender==2 & age ==13 & bmi >=28
replace bmicateg_female=1 if gender==2 & age ==14 & bmi >=29.5
replace bmicateg_female=1 if gender==2 & age ==15 & bmi >=30.5
replace bmicateg_female=1 if gender==2 & age ==16 & bmi >=31
replace bmicateg_female=1 if gender==2 & age ==17 & bmi >=32
replace bmicateg_female=1 if gender==2 & age ==18 & bmi >=32
replace bmicateg_female=1 if gender==2 & age ==19 & bmi >=32
//Bmi Categ for OVERIEGHT children for GILRS//
replace bmicateg_female=2 if gender==2 & age ==2 & bmi >=18 & bmi <=19.4
replace bmicateg_female=2 if gender==2 & age ==3 & bmi >=17 & bmi<=18.4
replace bmicateg_female=2 if gender==2 & age ==4 & bmi >=17 & bmi<=17.9
replace bmicateg_female=2 if gender==2 & age ==5 & bmi >=16.5 & bmi<=17.9
replace bmicateg_female=2 if gender==2 & age ==6 & bmi >=17 & bmi<=18.4
replace bmicateg_female=2 if gender==2 & age ==7 & bmi >=17 & bmi <=18.9
replace bmicateg_female=2 if gender==2 & age ==8 & bmi >=18 & bmi<=19.99
replace bmicateg_female=2 if gender==2 & age ==9 & bmi >=19 & bmi<=21.4
replace bmicateg_female=2 if gender==2 & age ==10 & bmi >=20 & bmi<=22.9
replace bmicateg_female=2 if gender==2 & age ==11 & bmi >=21 & bmi<=24.9
replace bmicateg_female=2 if gender==2 & age ==12 & bmi >=22.5 &bmi <=26.4
replace bmicateg_female=2 if gender==2 & age ==13 & bmi >=24 & bmi<=27.9
replace bmicateg_female=2 if gender==2 & age ==14 & bmi >=25 & bmi<=29.4
replace bmicateg_female=2 if gender==2 & age ==15 & bmi >=26 & bmi<=30.4
replace bmicateg_female=2 if gender==2 & age ==16 & bmi >= 27 & bmi<=30.9
replace bmicateg_female=2 if gender==2 & age ==17 & bmi >=27 & bmi<=31.9
replace bmicateg_female=2 if gender==2 & age ==18 & bmi >=27.5 & bmi<=31.9
replace bmicateg_female=2 if gender==2 & age ==19 & bmi >=27.5 & bmi <=31.9
and below is the dataex that did not match
input byte age float(height weight bmi gender bmicateg_female bmicateb_male BMI_cat)
10 120 33.1 22.98611 2 . . .
18 167 89 31.912226 1 . . .
12 140 50.8 25.91837 1 . . .
12 152 61 26.402355 2 . . .
17 159 79.4 31.406984 1 . . .
15 168 86 30.470524 2 . . .
18 166 88 31.93497 2 . . .
18 176 99 31.96023 1 . . .
17 171 92 31.46267 1 . . .
3 89 14.6 18.432016 1 . . .
3 93 16 18.499249 1 . . .
12 157 64 25.96454 1 . . .
12 158 66 26.43807 2 . . .
13 139 52 26.91372 1 . . .
3 87 14 18.496498 1 . . .
11 143 50 24.451075 1 . . .
14 139 55 28.466436 1 . . .
17 170 91 31.48789 1 . . .
12 157 65.2 26.451374 2 . . .
3 84 13 18.424038 1 . . .
15 156 74 30.40763 2 . . .
11 159 63 24.9199 2 . . .
17 154 75.7 31.91938 2 . . .
16 159 77 30.457655 1 . . .
10 140 44 22.44898 1 . . .
14 148 64.6 29.49233 2 . . .
16 165 83 30.486687 1 . . .
18 177 100 31.91931 1 . . .
18 167 89 31.912226 1 . . .
17 171 92 31.46267 1 . . .
15 156 74 30.40763 2 . . .
3 87 14 18.496498 2 . . .
3 84 13 18.424038 2 . . .
10 170 65 22.49135 1 . . .
13 135 51 27.98354 2 . . .
12 157 64 25.96454 1 . . .
14 174 86 28.405336 1 . . .
16 168 86 30.470524 1 . . .
15 160 78 30.46875 2 . . .
12 152 61 26.402355 2 . . .
17 165 87 31.955923 2 . . .
10 135 41 22.49657 1 . . .
16 156 74 30.40763 1 . . .
10 140 44 22.44898 1 . . .
13 154 64 26.986 1 . . .
18 166 88 31.93497 1 . . .
11 147 54 24.989586 2 . . .
18 164 86 31.975016 2 . . .
18 164 86 31.975016 1 . . .
16 170 88 30.449825 1 . . .
16 159 77 30.457655 1 . . .
11 140 48 24.4898 1 . . .
3 84 13 18.424038 2 . . .
12 143 54 26.40716 2 . . .
12 158 66 26.43807 2 . . .
16 164 82 30.487806 1 . . .
17 148 70 31.95763 2 . . .
11 143 50 24.451075 1 . . .
14 159 72 28.479885 1 . . .
11 153 57.2 24.43505 1 . . .
18 147 69 31.93114 2 . . .
14 144 61 29.417437 2 . . .
15 158 76 30.44384 2 . . .
10 143 46 22.49499 1 . . .
16 164 82 30.487806 1 . . .
3 96 17 18.446182 1 . . .
16 167 85 30.47797 1 . . .
15 170 85 29.41176 1 . . .
12 152 61 26.402355 2 . . .
10 155 54 22.47659 1 . . .
12 153 62 26.48554 2 . . .
13 157 68.8 27.91188 2 . . .
3 93 16 18.499249 2 . . .
16 165 83 30.486687 1 . . .
12 152 61 26.402355 2 . . .
12 152 61 26.402355 2 . . .
3 93 16 18.499249 2 . . .
11 154 58 24.456064 1 . . .
14 179 91 28.40111 1 . . .
15 160 78 30.46875 2 . . .
18 167 89 31.912226 2 . . .
10 140 44 22.44898 1 . . .
15 146 65 30.493525 2 . . .
10 146 49 22.987427 2 . . .
15 157 75 30.427197 2 . . .
16 170 88 30.449825 1 . . .
18 177 100 31.91931 1 . . .
10 130 38 22.48521 1 . . .
11 151 57 24.998903 2 . . .
11 155 60 24.97399 2 . . .
16 169 87 30.461117 1 . . .
10 140 44 22.44898 1 . . .
10 143 46 22.49499 1 . . .
16 145 65 30.915575 2 . . .
13 148 59 26.93572 1 . . .
17 170 91 31.48789 1 . . .
16 145 65 30.915575 2 . . .
12 141 52.5 26.407124 2 . . .
16 172 90 30.42185 1 . . .
17 166 88 31.93497 2 . . .
end
label values gender gn
label def gn 1 "Male", modify
label def gn 2 "Female", modify
label values BMI_cat bm1
kindly for your assistance please
Comment