Statalist


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

Re: st: generating houshold size


From   [email protected]
To   [email protected]
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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index