Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: AW: count in matched family-individuals file


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: count in matched family-individuals file
Date   Wed, 1 Jul 2009 13:14:31 +0200

<> 

BTW, your request does not strike me as rocket science, though I do admit I
do not understand the intent in b)...


*************
clear*

//# of families
set obs 1000

//id
gen familyid=_n

//family size: 5
expand 5

//get member identifier
bys fam: gen member=_n

//generate age [0;81]
gen memberage= /* 
 */ int(81*runiform())

//get # of member >18
bys fam: egen over18=/* 
 */ total(memberage>=18)
 
//let`s see
l in 1/30, /* 
 */ sepby(fam) noo
*************



HTH
Martin

-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Joana Estata
Gesendet: Mittwoch, 1. Juli 2009 12:31
An: [email protected]
Betreff: st: count in matched family-individuals file

I matched 2 files, one of households and other of individuals of each
household.
Now I have a file where the characteristics of each household are
associated with each individuals.
I want:
(a) to create a variable which count how many adults (18+) exist in
each household . Observations are individuals, so it means how many
times the same IDhousehold appears associated with an individual with
18 years old or upper.
(b) add the variable obtained in (a) to the household characteristics
(number of adults per household will be add to other characteristics
as size or income).
I have User Guide STATA Release 9, junt send me to a page.
Thanks
Joana
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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