Statalist


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

Re: st: using postfile in a loop


From   Austin Nichols <austinnichols@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: using postfile in a loop
Date   Mon, 9 Nov 2009 17:12:20 -0500

Martin Weiss <martin.weiss1@gmx.de> :
Well, it changes the output dataset, and the poster -sort-ed, so I did, too.

On Mon, Nov 9, 2009 at 5:04 PM, Martin Weiss <martin.weiss1@gmx.de> wrote:
>
> <>
>
> Why bother to -sort-? Does not change anything here, does it?
>
>
>
> HTH
> Martin
>
>
> -----Ursprüngliche Nachricht-----
> Von: owner-statalist@hsphsun2.harvard.edu
> [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Austin Nichols
> Gesendet: Montag, 9. November 2009 23:04
> An: statalist@hsphsun2.harvard.edu
> Betreff: Re: st: using postfile in a loop
>
> There is no loop there.  Try:
>
> use masterfile
> sort date ticker prc
> tempname A
> tempfile signals
> preserve
> qui sum RminusI, d
> keep if RminusI < r(p10)
> save `A'
> restore
>
> On Mon, Nov 9, 2009 at 4:54 PM, Kushan Thakkar <kthakk4@gmail.com> 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
>> the code I am using.
>>
>> =========================================
>>
>> use masterfile
>>
>> sort date ticker prc
>>
>> quitely sum RminusI
>>
>> tempname A
>> tempfile signals
>>
>> postfile 'A' ticker date prc using `signals', replace
>>
>> post `A' (if RminusI < r(p10) )  //post to a new file if RminusI is
>> less than first decile
>>
>> postclose `A'
>>
>> =========================================
>>
>> However, after the post command I get the following error:
>>
>> ifRminusI not found
>> post: above message corresponds to expression 1, variable cusip
>>
>>
>> What am I doing wrong? Is there a more efficient way to do this ?
>>
>> Thanks,
>> Kush
>
> *
> *   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