Statalist


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

Re: st: .do file = sort by t-score?


From   [email protected]
To   [email protected]
Subject   Re: st: .do file = sort by t-score?
Date   Wed, 18 Nov 2009 10:32:14 -0500

Thank you kindly for your reply!

I must admit I am a neophyte when it comes to Stata programming so I apologize for the perhaps dumb question, but do I simply paste the below into the do file below the bivariate regression commands?

I have tried to do this but get a "invalid 'tempname'" error. I assume I am missing something relatively straightforward, due to my lack of experience in this area and would be grateful for an explanation, as this would prevent me from having to go through line by line of text to pick out the significant t-scores.

Kind regards


Quoting Scott Merryman <[email protected]>:

Here is oneway:

sysuse auto
tempname memhold
tempfile results
 postfile `memhold' str12 name double t using `results', replace
foreach var  of varlist head-gear {
local name  "`var'"
	qui reg mpg `var'
	matrix e =e(b)
	matrix v = e(V)
	local t = abs(e[1,1]/sqrt(v[1,1]))
	post `memhold' ("`name'") (`t')
}
postclose `memhold'
use `results'
gsort -t
l


Scott


On Wed, Nov 18, 2009 at 8:37 AM,  <[email protected]> wrote:
I am running a very basic .do file which performs bi-variate regressions for
roughly 200 variables.  I would like to somehow receive an output that would
sort the independent variables by the highest t-score.  Alternatively, if
one knows of a simple way to export the output into excel and then sort by
t-score that is fairly straightforward, that would work as well (if I import
the text file using delimiters to excel, it is a bit tedious and cumbersome
to get the list of variables sorted by t-score).  Many thanks.

*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index