Number of persons living in the HH (excluding the persons declared as living outside the HH) (hmember)
Fichier: sn_qm_indiv
Aperçu
Type: Continu
Format: numeric
Largeur: 9
Décimales: 0
Intervalle: 1-44
Enregistrements valides: 0
Invalide: 0
Others
Notes
Variable calculated from the following variables:
- n_menage (Household number)
- n_indiv (Individual number in the HH)
- a4 (Living in the HH)

Stata program:
gen temp=1 if a4==1
replace temp=0 if a4==0
sort n_menage n_indiv
gen temp_2=temp if n_menage!=n_menage[_n-1]
replace temp_2=temp_2[_n-1]+temp if temp_2==.
sort n_menage n_indiv
egen hmember=max(temp_2), by(n_menage)
drop temp temp_2