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

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: Re: RE: Re: How to speed up loop |

Date |
Wed, 15 Sep 2004 18:15:23 +0100 |

Quite so. My code takes Friedrich's example as defining the rules. More importantly, if this is not true it is likely that identifiers can be mapped to new identifiers for which is true. The last section of the FAQ cited discusses a problem, which is at least similar, if not identical. Nick n.j.cox@durham.ac.uk > -----Original Message----- > From: owner-statalist@hsphsun2.harvard.edu > [mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of Michael > Blasnik > Sent: 15 September 2004 17:55 > To: statalist@hsphsun2.harvard.edu > Subject: st: Re: RE: Re: How to speed up loop > > > This is clearly the winner, as long as every record within > each hhid is > sequentially numbered by lineno -- i.e., lineno==_n for all > records within > each hhid, there are no gaps. > > Michael Blasnik > michael.blasnik@verizon.net > > > ----- Original Message ----- > From: "Nick Cox" <n.j.cox@durham.ac.uk> > To: <statalist@hsphsun2.harvard.edu> > Sent: Wednesday, September 15, 2004 12:43 PM > Subject: st: RE: Re: How to speed up loop > > > > Looks like > > > > by hhid : gen mage = age[mlineno] > > > > to me. No loops, no -merge-. > > > > Nick > > n.j.cox@durham.ac.uk > > > > Friedrich Huebler > > > > > I appreciate the responses that I received so far but > realize that my > > > initial message was not precise enough. > > > > > > The variable mlineno lists the line number of a household member's > > > mother. In household 1 in my example data, household > member 2 is the > > > mother of household member 3. In household 2, 1 is the > mother of 2, > > > and 3 is the mother of 4 and 5. I would like to create a variable > > > that lists the age of each household member's mother. The result > > > should look like this: > > > > > > hhid lineno age mlineno mage > > > 1 1 32 . . > > > 1 2 30 . . > > > 1 3 5 2 30 > > > 2 1 68 . . > > > 2 2 41 1 68 > > > 2 3 40 . . > > > 2 4 17 3 40 > > > 2 5 14 3 40 > > > > > > The loop that I am using to create the variable mage > works perfectly > > > but it is very slow with a large number of observations. > > > > > > Friedrich > > > > > > * > * 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/

- Prev by Date:
**Re: st: RE: Re: How to speed up loop** - Next by Date:
**st: Re: How to speed up loop** - Previous by thread:
**st: RE: Re: How to speed up loop** - Next by thread:
**st: RE: RE: RE: Re: How to speed up loop** - Index(es):

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