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

From |
Roger Newson <roger.newson@kcl.ac.uk> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: Re: basic question about varlist |

Date |
Tue, 05 Nov 2002 20:30:32 +0000 |

At 15:00 05/11/02 -0500, Radu Ban wrote:

If you want to export your proposed matrix to Excel, then the best way might be to create this matrix as a Stata data set, with 1 observation per model and variables -varname-, -coeff1-, -stderr1- etc., and then to export it to an Excel-compatible generic text spreadsheet using -outsheet-.thanks a lot for the prompt replies. however, i think i didn't explain my problem accurately. i'll start from the end result perhaps it makes more sense this way. please bear with me. in the end, i would like to have a matrix (to be exported in excel) with columns: varname coeff1 stderr1 coeff2 stderr2.... the variables under varname come from the varlist `outcomes' i described in the previous email (i.e. local outcomes " an_abbreviated_varlist "). to obtain the above mentioned matrix, i'm thinking of implementing the following loop: foreach var of varlist `outcomes' { reg `var' x1 x2... now somehow generate a scalar indexed by the position of `var' in varlist (i.e. scalar1 for first variable, scalar2 for second), equal to the coefficient of x1 do the same for the stderror of x1, coeff of x2, and so on } after the loop is done take these scalars and put them into the above mentioned matrix. the part i don't know how to do is to generate those scalars

There is more than one way to create such a Stata data set. However, I personally would first use my packages -parmest- and -dsconcat- to create a data set with 1 obs for each parameter of each of the models, and data on the estimates, standard errors, confidence intervals, P-values, and other results. I would then use official Stata's -reshape- command to reshape this data set into a wider data set, with one observation per model rather than one observation per parameter per model.

To find out more about the use of -parmest- and -dsconcat-, Radu might like to look at my presentation "Creating plots and tables of estimation results using parmest and friends", downloadable from the Stata User Meetings website at http://ideas.repec.org/s/boc/usug02.html.

I hope this helps.

Roger

--

Roger Newson

Lecturer in Medical Statistics

Department of Public Health Sciences

King's College London

5th Floor, Capital House

42 Weston Street

London SE1 3QD

United Kingdom

Tel: 020 7848 6648 International +44 20 7848 6648

Fax: 020 7848 6620 International +44 20 7848 6620

or 020 7848 6605 International +44 20 7848 6605

Email: roger.newson@kcl.ac.uk

Opinions expressed are those of the author, not the institution.

*

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

**References**:**st: RE: basic question about varlist***From:*"Jiang, Tao" <TJiang@air.org>

**st: Re: basic question about varlist***From:*"Radu Ban" <rban@nber.org>

- Prev by Date:
**st: RE: Re: basic question about varlist** - Next by Date:
**st: RE: RE: inner loop** - Previous by thread:
**st: Re: basic question about varlist** - Next by thread:
**st: RE: basic question about varlist** - Index(es):

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