Statalist


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

RE: st: using postfile in a loop


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: using postfile in a loop
Date   Mon, 9 Nov 2009 23:40:24 +0100

<>

http://www.stata.com/support/faqs/data/foreach.html



What do you mean by " gen variable with built-in loop"?

HTH
Martin

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Kushan Thakkar
Sent: Montag, 9. November 2009 23:34
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: using postfile in a loop

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/


*
*   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