Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Mata: I/O question


From   "Abdel Rahmen El Lahga" <rahmen.lahga@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Mata: I/O question
Date   Thu, 25 Oct 2007 23:05:03 +0200

Under Stata 9.2 I would like to perform Monte Carlo experiment my code
looks like
*============Begion code
n_mc=1000
mc = 1
while(mc <=n_mc) {
stmt1... stmt2...
results=a,b,c  // my estimation result as rowvector
mc=mc+1
}
*===========End code
I would like to accumulate each iteration results in a file (Either
Stata or ascii ).
So that, at the end of my monte carlo loop,  I can recuperate a file
with 1000 lines of estimation results.
I tried the following inside my loop
fh=fopen("my_result","a")
m=a,b,c
fwrite(fh,  m)
BUT mata return "fwrite():  3204  matrix found where scalar required"
Is there any method to write my results in a file ideally with
variable names (a b c ) in the first line
AbdelRahmen


-- 
AbdelRahmen El Lahga
*
*   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