Hi everyone,
I would really like some advice on how to use convert my data to kcal using both sex and age of the individual in a household (HHID). For instance, there are 6 individuals in HHID 1013000201 with different sex-age categories, I want to use the information given by the variable sex and age for kcal conversion.
Do I create a look up table in this case or would it be too complicated since there are a lot of individuals with different age and sex combinations? Thank you for any advice!
* Example generated by -dataex-. To install: ssc install dataex
clear
input str12 HHID str14 PID byte(sex hh_age) float(hh_agecat age_sexcat)
"1013000201" "101300020102" 2 28 11 6
"1013000201" "101300020103" 1 17 10 6
"1013000201" "101300020106" 1 6 5 6
"1013000201" "101300020104" 1 11 7 6
"1013000201" "101300020105" 1 9 6 6
"1013000201" "101300020101" 2 44 12 6
"1013000204" "101300020403" 2 6 5 5
"1013000204" "101300020405" 2 0 1 5
"1013000204" "101300020404" 2 2 2 5
"1013000204" "101300020402" 2 32 12 5
"1013000204" "101300020401" 1 34 12 5
"1013000206" "101300020601" 1 29 11 1
"1013000210" "101300021001" 1 38 12 1
"1013000213" "101300021301" 1 31 12 1
"101300021302" "1013000213030" 1 5 4 4
"101300021302" "10130002130201" 1 35 12 4
"101300021302" "10130002130204" 1 0 1 4
"101300021302" "1013000213020" 2 28 11 4
"1021000102" "102100010205" 2 19 11 5
"1021000102" "102100010203" 2 10 6 5
"1021000102" "102100010201" 1 39 12 5
"1021000102" "102100010204" 2 2 2 5
"1021000102" "102100010206" 2 19 11 5
"1021000102" "102100010202" 2 37 12 5
"1021000108" "102100010804" 1 23 11 5
"1021000108" "102100010803" 2 25 11 5
"1021000108" "102100010806" 2 17 10 5
"1021000108" "102100010805" 1 20 11 5
"1021000108" "102100010802" 2 59 12 5
"1021000108" "102100010801" 1 70 13 5
"1021000109" "102100010903" 2 16 9 6
"1021000109" "102100010906" 2 1 1 6
"1021000109" "102100010902" 2 22 11 6
"1021000109" "102100010904" 1 12 7 6
"1021000109" "102100010905" 1 19 11 6
"1021000109" "102100010901" 2 39 12 6
"1021000110" "102100011002" 2 44 12 4
"1021000110" "102100011003" 1 25 11 4
"1021000110" "102100011006" 2 19 11 4
"1021000110" "102100011004" 1 23 11 4
"1021000110" "102100011005" 1 21 11 4
"1021000110" "102100011001" 1 53 12 4
"1021000111" "102100011103" 1 15 9 8
"1021000111" "102100011102" 2 17 10 8
"1021000111" "102100011108" 1 18 10 8
"1021000111" "102100011110" 1 16 9 8
"1021000111" "102100011109" 1 15 9 8
"1021000111" "102100011107" 2 20 11 8
"1021000111" "102100011106" 1 25 11 8
"1021000111" "102100011105" 2 5 4 8
"1021000111" "102100011104" 1 13 8 8
"1021000111" "102100011101" 1 47 12 8
"1021000113" "102100011308" 2 17 10 8
"1021000113" "102100011302" 2 43 12 8
"1021000113" "102100011307" 1 4 4 8
"1021000113" "102100011304" 1 14 8 8
"1021000113" "102100011306" 1 10 6 8
"1021000113" "102100011301" 1 47 12 8
"1021000113" "102100011305" 2 12 7 8
"1021000113" "102100011309" 2 32 12 8
"1021000113" "102100011303" 1 20 11 8
"1021000201" "102100020103" 1 14 8 5
"1021000201" "102100020101" 1 41 12 5
"1021000201" "102100020105" 2 16 9 5
"1021000201" "102100020102" 2 38 12 5
"1021000201" "102100020104" 2 9 6 5
"1021000202" "102100020201" 1 43 12 3
"1021000202" "102100020203" 2 14 8 3
"1021000202" "102100020202" 2 20 11 3
"1021000203" "102100020309" 1 7 5 10
"1021000203" "102100020306" 1 12 7 10
"1021000203" "102100020307" 1 14 8 10
"1021000203" "102100020305" 2 17 10 10
"1021000203" "102100020304" 1 20 11 10
"1021000203" "102100020303" 2 27 11 10
"1021000203" "102100020302" 1 37 12 10
"1021000203" "102100020308" 2 4 4 10
"1021000203" "102100020310" 1 2 2 10
"1021000203" "102100020301" 2 58 12 10
"102100020304" "10210002030401" 1 27 11 4
"102100020304" "10210002030404" 1 3 3 4
"102100020304" "10210002030403" 1 6 5 4
"102100020304" "1021000203040" 2 24 11 4
"1021000207" "102100020703" 1 13 8 4
"1021000207" "102100020702" 2 38 12 4
"1021000207" "102100020704" 2 17 10 4
"1021000207" "102100020701" 1 41 12 4
"1021000209" "102100020901" 1 59 12 1
"1021000210" "102100021001" 1 35 12 1
"1021000212" "102100021202" 2 17 10 4
"1021000212" "102100021204" 1 4 4 4
"1021000212" "102100021203" 1 15 9 4
"1021000212" "102100021201" 2 48 12 4
"1021000213" "102100021309" 2 5 4 8
"1021000213" "102100021307" 2 20 11 8
"1021000213" "102100021306" 2 17 10 8
"1021000213" "102100021303" 1 25 11 8
"1021000213" "102100021302" 2 42 12 8
"1021000213" "102100021305" 2 21 11 8
"1021000213" "102100021304" 1 22 11 8
end
label values sex H2Q3
label def H2Q3 1 "MALE", modify
label def H2Q3 2 "FEMALE", modify
[/CODE]
------------------ copy up to and including the previous line ------------------
Listed 100 out of 17673 observations
Use the count() option to list more
.
I would really like some advice on how to use convert my data to kcal using both sex and age of the individual in a household (HHID). For instance, there are 6 individuals in HHID 1013000201 with different sex-age categories, I want to use the information given by the variable sex and age for kcal conversion.
Do I create a look up table in this case or would it be too complicated since there are a lot of individuals with different age and sex combinations? Thank you for any advice!
* Example generated by -dataex-. To install: ssc install dataex
clear
input str12 HHID str14 PID byte(sex hh_age) float(hh_agecat age_sexcat)
"1013000201" "101300020102" 2 28 11 6
"1013000201" "101300020103" 1 17 10 6
"1013000201" "101300020106" 1 6 5 6
"1013000201" "101300020104" 1 11 7 6
"1013000201" "101300020105" 1 9 6 6
"1013000201" "101300020101" 2 44 12 6
"1013000204" "101300020403" 2 6 5 5
"1013000204" "101300020405" 2 0 1 5
"1013000204" "101300020404" 2 2 2 5
"1013000204" "101300020402" 2 32 12 5
"1013000204" "101300020401" 1 34 12 5
"1013000206" "101300020601" 1 29 11 1
"1013000210" "101300021001" 1 38 12 1
"1013000213" "101300021301" 1 31 12 1
"101300021302" "1013000213030" 1 5 4 4
"101300021302" "10130002130201" 1 35 12 4
"101300021302" "10130002130204" 1 0 1 4
"101300021302" "1013000213020" 2 28 11 4
"1021000102" "102100010205" 2 19 11 5
"1021000102" "102100010203" 2 10 6 5
"1021000102" "102100010201" 1 39 12 5
"1021000102" "102100010204" 2 2 2 5
"1021000102" "102100010206" 2 19 11 5
"1021000102" "102100010202" 2 37 12 5
"1021000108" "102100010804" 1 23 11 5
"1021000108" "102100010803" 2 25 11 5
"1021000108" "102100010806" 2 17 10 5
"1021000108" "102100010805" 1 20 11 5
"1021000108" "102100010802" 2 59 12 5
"1021000108" "102100010801" 1 70 13 5
"1021000109" "102100010903" 2 16 9 6
"1021000109" "102100010906" 2 1 1 6
"1021000109" "102100010902" 2 22 11 6
"1021000109" "102100010904" 1 12 7 6
"1021000109" "102100010905" 1 19 11 6
"1021000109" "102100010901" 2 39 12 6
"1021000110" "102100011002" 2 44 12 4
"1021000110" "102100011003" 1 25 11 4
"1021000110" "102100011006" 2 19 11 4
"1021000110" "102100011004" 1 23 11 4
"1021000110" "102100011005" 1 21 11 4
"1021000110" "102100011001" 1 53 12 4
"1021000111" "102100011103" 1 15 9 8
"1021000111" "102100011102" 2 17 10 8
"1021000111" "102100011108" 1 18 10 8
"1021000111" "102100011110" 1 16 9 8
"1021000111" "102100011109" 1 15 9 8
"1021000111" "102100011107" 2 20 11 8
"1021000111" "102100011106" 1 25 11 8
"1021000111" "102100011105" 2 5 4 8
"1021000111" "102100011104" 1 13 8 8
"1021000111" "102100011101" 1 47 12 8
"1021000113" "102100011308" 2 17 10 8
"1021000113" "102100011302" 2 43 12 8
"1021000113" "102100011307" 1 4 4 8
"1021000113" "102100011304" 1 14 8 8
"1021000113" "102100011306" 1 10 6 8
"1021000113" "102100011301" 1 47 12 8
"1021000113" "102100011305" 2 12 7 8
"1021000113" "102100011309" 2 32 12 8
"1021000113" "102100011303" 1 20 11 8
"1021000201" "102100020103" 1 14 8 5
"1021000201" "102100020101" 1 41 12 5
"1021000201" "102100020105" 2 16 9 5
"1021000201" "102100020102" 2 38 12 5
"1021000201" "102100020104" 2 9 6 5
"1021000202" "102100020201" 1 43 12 3
"1021000202" "102100020203" 2 14 8 3
"1021000202" "102100020202" 2 20 11 3
"1021000203" "102100020309" 1 7 5 10
"1021000203" "102100020306" 1 12 7 10
"1021000203" "102100020307" 1 14 8 10
"1021000203" "102100020305" 2 17 10 10
"1021000203" "102100020304" 1 20 11 10
"1021000203" "102100020303" 2 27 11 10
"1021000203" "102100020302" 1 37 12 10
"1021000203" "102100020308" 2 4 4 10
"1021000203" "102100020310" 1 2 2 10
"1021000203" "102100020301" 2 58 12 10
"102100020304" "10210002030401" 1 27 11 4
"102100020304" "10210002030404" 1 3 3 4
"102100020304" "10210002030403" 1 6 5 4
"102100020304" "1021000203040" 2 24 11 4
"1021000207" "102100020703" 1 13 8 4
"1021000207" "102100020702" 2 38 12 4
"1021000207" "102100020704" 2 17 10 4
"1021000207" "102100020701" 1 41 12 4
"1021000209" "102100020901" 1 59 12 1
"1021000210" "102100021001" 1 35 12 1
"1021000212" "102100021202" 2 17 10 4
"1021000212" "102100021204" 1 4 4 4
"1021000212" "102100021203" 1 15 9 4
"1021000212" "102100021201" 2 48 12 4
"1021000213" "102100021309" 2 5 4 8
"1021000213" "102100021307" 2 20 11 8
"1021000213" "102100021306" 2 17 10 8
"1021000213" "102100021303" 1 25 11 8
"1021000213" "102100021302" 2 42 12 8
"1021000213" "102100021305" 2 21 11 8
"1021000213" "102100021304" 1 22 11 8
end
label values sex H2Q3
label def H2Q3 1 "MALE", modify
label def H2Q3 2 "FEMALE", modify
[/CODE]
------------------ copy up to and including the previous line ------------------
Listed 100 out of 17673 observations
Use the count() option to list more
.
Comment