I am using STATA 12.1 and working with the person file of a household census. My aim is to reclassify the 14 categories of relationships to head in the census, based on women aged 15-49 in that particular household as the unit of reference. I want to ascertain the living arrangements of this group of interest, whether they live with people from their own generation (e.g Brother, Sister) and/or people from the previous generation (e.g Parent, Uncle, Aunt). What i first did was create dummy variables for all the household relation categories to head which show whether or not a woman aged 15-49 years was present/absent in a household. For ease of explanation i am going to use 1 household category (Son/Daughter), the code i used to establish the presence of a woman in a household in this category was through creation of a variable 'daughter.'
Code:
by SN, sort: gen house=. replace house=1 if P02_RELATION==3 & F03_SEX==2 & F02_AGE>=15 & F02_AGE<=49 replace house=0 if (P02_RELATION==3 & F03_SEX==2 & F02_AGE<15 | F02_AGE>49) | (P02_RELATION==3 & F03_SEX!=2) | P02_RELATION!=3 egen daughter=max(house), by( SN) browse SN P02_RELATION F03_SEX F02_AGE daughter label variable daughter "Head's daughter aged 15-49 years present in H/hold" label define daughter 1"Present" 0"Absent" label values daughter daughter
Code:
generate relation_daughter=. replace relation_daughter=1 if daughter==1 & P02_RELATION==1 replace relation_daughter=2 if daughter==1 & P02_RELATION==2 replace relation_daughter=3 if (daughter==1 & P02_RELATION==3 & F03_SEX==1) | (daughter==1 & P02_RELATION ==4) replace relation_daughter=4 if daughter==1 & P02_RELATION==5 replace relation_daughter=5 if daughter==1 & (P02_RELATION==6|P02_RELATION==11) replace relation_daughter=6 if daughter==1 & (P02_RELATION==7|P02_RELATION==8) replace relation_daughter=7 if daughter==1 & P02_RELATION==9 & P14A_MOTHERPNR!=98 & P14A_MOTHERPNR!=. replace relation_daughter=8 if daughter==1 & P02_RELATION==9 & (P14A_MOTHERPNR==98 |P14A_MOTHERPNR==.) replace relation_daughter=9 if daughter==1 & P02_RELATION==10 & F03_SEX==1 replace relation_daughter=10 if daughter==1 & P02_RELATION==10 & F03_SEX==2 replace relation_daughter=11 if daughter==1 & P02_RELATION==12 replace relation_daughter=12 if daughter==1 & P02_RELATION==13 replace relation_daughter=13 if daughter==1 & P02_RELATION==14 label variable relation_daughter "Relation to daughter" label define relation_daughter 1"Father/Mother" 2"Mother/Father or Stepfather/mother" 3"Brother/Sister" 4"Stepsibling" 5"Uncle/Aunt" 6"Grandmother/Father or Step Grandparent" 7"Son/Daughter or Nephew/Niece" 8"Nephew/Niece or Grandson/daughter" 9"Husband or Brother-in-law" 10"Sister-in-law" 11"Great-grandmother/Father" 12"Other relative" 13"Non-related person" label values relation_daughter relation_daughter tab relation_daughter
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input double SN int(F00_NR F02_AGE) byte(F03_SEX P02_RELATION P14A_MOTHERPNR P15A_FATHERPNR) float(daughter relation_daughter) 10000010084 1 49 1 1 . . 1 1 10000010084 2 44 2 2 98 . 1 2 10000010084 4 17 1 3 2 1 1 3 10000010084 3 18 2 3 2 1 1 . 10000010084 5 11 1 3 2 1 1 3 10000010084 6 0 1 9 3 98 1 7 10000010084 7 24 2 13 98 98 1 12 10000010084 8 18 1 13 98 . 1 12 end label values F03_SEX F03_SEX label def F03_SEX 1 "1. Male", modify label def F03_SEX 2 "2. Female", modify label values P02_RELATION P02_RELATION label def P02_RELATION 1 "1. Head/Acting head", modify label def P02_RELATION 2 "2. Husband/wife/partner", modify label def P02_RELATION 3 "3. Son/daughter", modify label def P02_RELATION 9 "9. Grand/greatgrand child", modify label def P02_RELATION 13 "13. Other relative", modify label values P14A_MOTHERPNR P14A_MOTHERPNR label def P14A_MOTHERPNR 98 "98. Mother not in the household", modify label values P15A_FATHERPNR P15A_FATHERPNR label def P15A_FATHERPNR 98 "98. Father not in the household", modify label values daughter daughter label def daughter 1 "Present", modify label values relation_daughter relation_daughter label def relation_daughter 1 "Father/Mother", modify label def relation_daughter 2 "Mother/Father or Stepfather/mother", modify label def relation_daughter 3 "Brother/Sister", modify label def relation_daughter 7 "Son/Daughter or Nephew/Niece", modify label def relation_daughter 12 "Other relative", modify
0 Response to Recoding household relationships in a census based on women aged 15-49 in a household
Post a Comment