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]
Re: st: How to print and append to file akin to -display-?
From
"Michael N. Mitchell" <[email protected]>
To
[email protected]
Subject
Re: st: How to print and append to file akin to -display-?
Date
Tue, 15 Jun 2010 21:21:30 -0700
Rock on Misha! I was about 10 seconds from hitting "send" on the exact same code snippet
that you posted.
If you should want to, instead, save the results to a dataset, you can see
http://www.michaelnormanmitchell.com/stow/posting-results-regression.html
Best regards,
Michael N. Mitchell
Data Management Using Stata - http://www.stata.com/bookstore/dmus.html
A Visual Guide to Stata Graphics - http://www.stata.com/bookstore/vgsg.html
Stata tidbit of the week - http://www.MichaelNormanMitchell.com
On 2010-06-15 9.08 PM, Misha Spisok wrote:
Can I answer my own question?
Here's what I did, but I'm clearly open to better suggestions.
sysuse auto, clear
local regressors mpg rep78 headroom trunk weight
file open myfile using testfile.txt, write replace
foreach var of varlist `regressors' {
quietly {
regress price `var'
}
file write myfile %10s "coef `var' " _column(24) %7.3f (_b[`var']) _n
file write myfile %10s "t-stat `var' " _column(24) %7.3f
(_b[`var']/_se[`var']) _n
}
file close myfile
Thanks.
Misha
On Tue, Jun 15, 2010 at 8:10 PM, Misha Spisok<[email protected]> wrote:
Hello, Statalist,
I'd like to know how I can print and append my own "output" to a file.
For example,
sysuse auto, clear
local regressors mpg rep78 headroom trunk weight
foreach var of varlist `regressors' {
quietly {
regress price `var'
}
display in yellow "coef `var'" _column(24) _b[`var']
display in white "t-stat `var'" _column(24) _b[`var']/_se[`var']
}
Rather than displaying these, I want to print what follows -display-
to a file (pardon me if this is the incorrect terminology).
Thanks for your time.
Best,
Misha
*
* 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/
*
* 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/
*
* 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/