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

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


From   "Scott Merryman" <smerryman@kc.rr.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: RE: RE: RE: Re: How to speed up loop
Date   Fri, 17 Sep 2004 09:26:30 -0500

Nick and Ernest,

Thank you for the explanations.  I was under the impression that the
explicit subscripting "function" would only evaluate numbers or the built-in
variables _n and _N.

Thanks again,
Scott



> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-
> statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
> Sent: Friday, September 17, 2004 6:52 AM
> To: statalist@hsphsun2.harvard.edu
> Subject: st: RE: RE: RE: Re: How to speed up loop

<snip>

> 
> . by hhid : gen mage = age[mlineno]
> 
> Take
> 
> hhid    lineno       age   mlineno      mage
>   1         1        32         .         .
>   1         2        30         .         .
>   1         3         5         2        30
> 
> Each expression within [ ] is evaluated
> separately for each observation. For
> the first and second
> 
> 	age[mlineno] becomes age[.]
> 
> which is taken as missing. For the third,
> 
> 	age[mlineno] becomes age[3]
> 
> which by the wrinkle rule above is 30.
> It is the third observation _within that group_.

<snip>

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index