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

Re: st: Saving and appending to a file


From   "Danielle H. Ferry" <[email protected]>
To   [email protected]
Subject   Re: st: Saving and appending to a file
Date   Thu, 23 Oct 2003 09:28:40 -0400

Suppose you had a variable, sample, that took values 1, 2, 3, 4. Then perhaps you could do something like this:

forval i = 1(1)4

tempfile tf`i'

(estimation) if sample==`i'

(your matrix stuff)

outsheet (stuff) using `tf`i''

}

dsconcat `tf1' `tf2' `tf3' `tf4'

Not sure what you are estimating, but in place of your using the estimation matrices directly, have you looked into <outreg> or <parmest>?

On Thursday, October 23, 2003, at 04:27 AM, Philippe Huber wrote:


Hello all,

I want to repeat the same estimation for a set of samples each written in different files (say DataFile1.txt, DataFile2.txt…). I think that a “foreach” command would be adequate but how exactly?

Secondly, I want the results to be saved in a single file, it means appending to an output file. I thought using something like

matrixA=e(b)
svmatA
gencount=_n

outsheetA1-A35 using resultsStata.txt if count==1, nonames

but, the problem is that it won’t save if the file “resultStata.txt” already exists. Obviously, if I use the replace command, it will erase the previous estimations. What can I do?

Thanks to all

Philippe Huber
University of Geneva
Department of Econometrics
Pont d'Arve 40
1211 Geneva, Switzerland
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index