Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Taking Means of Vars Across Time Period


From   Thomas Trikalinos (.Mac) <[email protected]>
To   [email protected]
Subject   Re: st: Taking Means of Vars Across Time Period
Date   Wed, 16 Jun 2004 18:50:37 +0300

Can't you put everything in the same dataset? you can use a coding variable named data to indicate origin of the pertinent observations.
(If the corresponding vars are not identically named in different datasets rename them all to var1 , var2 and var3).

. use dataSet1.dta
. gen data =1
. append using dataSet2.dta
. replace data = 2 if data ==.

etc, and then calculate whatever you want. eg for all obs pooled

. summ

or for each dataset separately

. bysort data: summ

Cheers

Tom

PS you can easily automate that, if you have more than 10 datasets (or even with ten). rename the datasets as dataSet1.dta etc.; write and run the do file:

use dataSet1.dta
gen data =1

local i = 2
while `i' <11 {
append using dataSet`i'.dta
replace data = `i' if data ==.
local i = `i' +1
}

Which in essence does the same as the step by step process.

On Jun 16, 2004, at 18:37, Frank Zhang wrote:


Dear Statalisters,

I have a question regarding taking means for data
across 10 time periods. For example,

For each of the 10 periods, I have a separate dataset
like

      var1   var2   var3
obs1   --     --     --
obs2   --     --     --
obs3   --     --     --


How do I taking means of var1-var3 for all
observations across those 10 time periods with STATA?
Or if EXCEL is easier, how can i do it with EXCEL.
Help me out, thank you very much.




		
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail
*
*   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/

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



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