Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: Postfile "forgets" the postfile


From   Sebastian Eppner <[email protected]>
To   [email protected]
Subject   st: Postfile "forgets" the postfile
Date   Thu, 24 Feb 2011 02:21:16 +0100

Hi,

at some point in my code i define a postfile, in which i want to write
4 variables, say one two three four.

. postfile x one two three four using somedataset, replace

then open a forval loop and after some calculations i want to add new
observations to the postfile, using the code:

. post y (one) (two) (three) (four)

unfortunately, at this point stata tells me:
post x not found
r(111);

So apparently, Stata lost the postfile definition along the way somehow...

I could track down the exact point at which Stata lost the
information, which is a selfwritten ado.
So the problem lies probably in the ado. I suspect the preserve /
restore / clear combination i use in there. I am not an experienced
ado writer, so please help me. the simplified structure of the ado is
like this:

program tuples2, rclass
    version 9
        syntax varlist(min=1 max=1 numeric) [if] [in]
....
preserve
clear

set obs2
.....do some stuff
.....write the results i am interested in into return macros
restore
end


Could this "clear" be responsible for the damage? If yes, is there
another way I can "start from scratch" in the ado file (and in the end
restore the damage done) while NOT hurting the postfile definition?

Thanks for a little help.
Sebastian

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index