Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: generating houshold size


From   orozco@toulouse.inra.fr
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: generating houshold size
Date   Thu, 28 Aug 2008 09:04:12 +0200

Leonie,

what about a loop over the household members variables?
Suppose each member household have information through variable varMember`i'
(and if for one household this variable is missing, this means there is no
member number i)

gen HouseholdSize = 0 /*Size of household*/

/*NbMemberMax is the max nb of members in your data*/
forv i = 1/NbMemberMax {
	replace HouseholdSize = HouseholdSize + 1 if varMember`i'!=.
}






© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index