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

st: AW: using postfile in a loop

From   "Martin Weiss" <>
To   <>
Subject   st: AW: using postfile in a loop
Date   Mon, 9 Nov 2009 22:58:48 +0100



	su RminusI, det
	keep if RminusI<r(p10)
	save myfile, replace

and "myfile" will contain the cases you want. Make it a -tempfile- if

-post- does not take an -if- qualifier, for one. And "r(p10)" would  not be
available to the -if- qualifier since you did not specify -detail- as an
option to your -summarize-...


-----Ursprüngliche Nachricht-----
[] Im Auftrag von Kushan Thakkar
Gesendet: Montag, 9. November 2009 22:54
Betreff: st: using postfile in a loop

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 ?

*   For searches and help try:

*   For searches and help try:

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