Bookmark and Share

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]

st: Exporting descriptive statistics to excel


From   Kyle Peyton <[email protected]>
To   "<[email protected]>" <[email protected]>
Subject   st: Exporting descriptive statistics to excel
Date   Mon, 12 Sep 2011 12:23:33 +0000

Hi all,


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.

Thanks!

Kyle

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index