Statalist


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

Re: st: using postfile in a loop


From   Kushan Thakkar <kthakk4@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: using postfile in a loop
Date   Mon, 9 Nov 2009 17:34:06 -0500

Thanks everyone for calling me out on the no loop part.

On a different note, how can I loop on a single variable ? For
example, let's say if I wanted to loop over the date variable and then
over the cusip variable, how would I go about doing this? I understand
that there is no need to explicitly create loop since I can use gen
variable with built-in loop. However, I want to do this so that I can
understand how loops and postfile work with each other.

Thanks.

On Mon, Nov 9, 2009 at 5:14 PM, Maarten buis <maartenbuis@yahoo.co.uk> wrote:
> --- On Mon, 9/11/09, Kushan Thakkar wrote:
>> I have a dataset the contains the following data:
>>
>> cusip ticker date prc ....(few more variables).... RminusI
>>
>> I need to isolate data points for which RminusI is less
>> than its first decile and then post these data points in a
>> different file.
>
> This is not a case for -postfile- or a loop. In the example
> below nlsw88.dta is your master data, grade is your id variable,
> and wage is your RminusI variable.
>
> *---------- begin example --------------
> sysuse nlsw88, clear
> bys grade: egen lb = pctile(wage), p(10)
> keep if wage < lb
> *------------ end example --------------
> ( For more on how to use examples I sent to statalist see:
> http://www.maartenbuis.nl/stata/exampleFAQ.html )
>
> Hope this helps,
> Maarten
> --------------------------
> Maarten L. Buis
> Institut fuer Soziologie
> Universitaet Tuebingen
> Wilhelmstrasse 36
> 72074 Tuebingen
> Germany
>
> http://www.maartenbuis.nl
> --------------------------
>
>
>
>
>
>
>
> *
> *   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index