Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: Exporting descriptive statistics to excel


From   Roger Newson <r.newson@imperial.ac.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Exporting descriptive statistics to excel
Date   Mon, 12 Sep 2011 13:51:38 +0100

If your colleagues insist on Microsoft Excel output (as a lot of people's colleagues do), a possible answer is to create an output dataset (or resultsset) using -collapse- and then to output this resultsset to a generic tab-delimited form using -outsheet-, which can create generic tab-delimited spreadsheets which Microsoft Excel can then read and convert to other formats if necessary.

I hope this helps.

Best wishes

Roger


Roger B Newson BSc MSc DPhil
Lecturer in Medical Statistics
Respiratory Epidemiology and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton Campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
UNITED KINGDOM
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Email: r.newson@imperial.ac.uk
Web page: http://www.imperial.ac.uk/nhli/r.newson/
Departmental Web page:
http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/popgenetics/reph/

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

On 12/09/2011 13:42, Kyle Peyton wrote:
Thanks Nick!
________________________________________
From: owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] on behalf of Nick Cox [njcoxstata@gmail.com]
Sent: Monday, 12 September 2011 10:33 PM
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: Exporting descriptive statistics to excel

I don't think anything in your question calls for use of MS Excel.

Have a look at -tabstat- or -collapse-.

-tabstat- will show a table of summary statistics very easily. Whether
the variable names are structured is immaterial.

Similar comments on -collapse-.

Nick

On Mon, Sep 12, 2011 at 1:23 PM, Kyle Peyton<kyle.peyton@unimelb.edu.au>  wrote:

I've been trying to work out something that I think should be pretty simple. I have a large time series dataset and I want to examine the very basic summary statistics that are reported by the sum command for several select variables across 9 years. The code I have written to accomplish this in Stata is the following:


forvalues year = 2000/2009  {
      foreach x of varlist `list1' {
                display `year'
                sum `x' if year == `year'
                }
}

Which loops through and gives me the summary statistics for each variable in each year. Unfortunately this is quite a long list. Is it possible to export the data to excel and have a look at each variable across each year, so my top excel row would look like this: Year Variable Obs Mean Std. Dev. Min Max for a total of 8 columns, which would contain all my summary statistics? I realize it may be better if I first rename all the variables in `list1' to include a _year suffix and thereby reduce my desired excel column width to 7 before trying to export. Any suggestions would be greatly appreciated.


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


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index