Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Postfile Question [Stata 8.2]


From   "Scott Merryman" <smerryman@kc.rr.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Postfile Question [Stata 8.2]
Date   Sun, 8 May 2005 19:22:04 -0500

How about not using a tempfile and -postfile- and -postclose- for each
iteration. 

For example: 

sysuse auto, clear

forv i = 29(-1)25 {
	postfile hold integration_points  b_cons b_price using results`i',
replace 
	disp "number of integration points  " `i'
	qui gllamm fore price , i(rep) nip(`i') 
	post hold (`i') (_b[_cons]) (_b[price])
	postclose hold
}

Then you to use Roger Newson's -dsconcat- to append to individual files
together.

Scott

> -----Original Message-----
> From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-
> statalist@hsphsun2.harvard.edu] On Behalf Of Bryan W. Griffin
> Sent: Friday, May 06, 2005 7:38 AM
> To: statalist@hsphsun2.harvard.edu
> Subject: st: Postfile Question [Stata 8.2]
> 
> I'm using Stata 8.2.
> 
> I created a do file to re-estimate a model several times, and after each
> run I want estimates to be posted to the tempfile which I named model_1. I
> thought that by specifying "every(1)" in the "postfile" part of the
> command
> that estimates would be posted to model_1 after the model is estimated
> each
> time. Last night I go to bed after running this do file for 8 hours
> thinking that it was half complete, and this morning I find that the
> computer rebooted for some reason. The estimates from the models
> completed,
> however, were not in the file model_1 -- it was blank.
> 
> How do I get postfile to store estimates after each pass so I won't lose
> estimates again should the computer reboot? Commands used are listed
> below.
> 
> 
> 
> 
> tempname abort
> tempfile model_1
> 
> postfile `abort' quad_point ///
> b0_cons b1_sex b2_option2  ///
> se0_cons se1_sex se2_option2  ///
> using "C:\sample file\model_1", every(1)
> 
> forvalues i = 29(-1)20  {
> 
> display `i'
> gllamm resp sex option2 option3, i(id) fam(bin) link(logit) adapt nip(`i')
> allc
> 
> post `abort'  (`i') ///
> (_b[resp:_cons]) (_b[resp:sex]) (_b[resp:option2]) ///
> (_se[resp:_cons]) (_se[sex]) (_se[option2])
> 
> }
> 
> postclose `abort'



*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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