Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: data management


From   Kemal Aslan <[email protected]>
To   [email protected]
Subject   Re: st: data management
Date   Sat, 19 Nov 2005 20:05:22 +0200

Dear Svend,
Thank you for your kind help. For maxage and bromaxage, my main
motivation was to take into account twin, triple kids. But,
unfortunately, I can't use then efficiently in the first place to
derive the number of older boys.
If I turn back to your code, could you give me any advice how  I can
take into acoount twin, triple kids?
Thank you very much in advance.
Kemal Aslan

On 11/19/05, Svend Juul <[email protected]> wrote:
> I don't see what -maxage- and -bromaxage- are for; I guess that 19
> is the maximum age to be classified as a child (although one had 16
> as maxage; was that a typo?).
>
> So, assuming that hhid, hrelhd, age, and female are the primary
> variables, I did this:
>
> clear
> input str4 hhid hrelhd age female
> 10_7 1 43 0
> 10_7 2 38 1
> 10_7 3 19 0
> 10_7 3 16 1
> 10_7 3 13 1
> 10_7 3 11 0
> end
>
> // Make a separate category for offspring > 19 years.
> replace hrelhd=4 if hrelhd==3 & age>19 & age<.
>
> gen male=1-female
> gsort hhid hrelhd -age
> by hhid hrelhd: gen boysum = sum(male) if hrelhd==3
> gen nolderbr=boysum-male
> sort hhid hrelhd age
> list
>
>      +---------------------------------------------------------+
>      | hhid   hrelhd   age   female   male   boysum   nolderbr |
>      |---------------------------------------------------------|
>   1. | 10_7        1    43        0      1        .          . |
>   2. | 10_7        2    38        1      0        .          . |
>   3. | 10_7        3    11        0      1        2          1 |
>   4. | 10_7        3    13        1      0        1          1 |
>   5. | 10_7        3    16        1      0        1          1 |
>      |---------------------------------------------------------|
>   6. | 10_7        3    19        0      1        1          0 |
>      +---------------------------------------------------------+
>
> Hope this helps
> Svend
>
> ________________________________________________________
>
> Svend Juul
> Institut for Folkesundhed, Afdeling for Epidemiologi
> (Institute of Public Health, Department of Epidemiology)
> Vennelyst Boulevard 6
> DK-8000 Aarhus C,  Denmark
> Phone, work:  +45 8942 6090
> Phone, home:  +45 8693 7796
> Fax:          +45 8613 1580
> E-mail:       [email protected]
> _________________________________________________________
>
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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