It is an example, you paste it in a new do-file, like in http://www.maartenbuis.nl/example_faq/index.html#work . The first step is to run that example and see the output. Than you can look at each line separately, understand what it does (use -help- to find out what a command does), and change it to fit your data.
--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany
http://www.maartenbuis.nl
--------------------------
--- On Wed, 18/11/09, [email protected] wrote:
> 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/
>
*
* 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/