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

Re: st: collapse panel data for each year


From   Ada Ma <[email protected]>
To   [email protected]
Subject   Re: st: collapse panel data for each year
Date   Sat, 29 May 2004 17:23:19 +0100

it might worth you the time to check out the command -egen-?

say you trying to calculate the profit mean of each country:

bys country year: egen meanprofit=mean(profit)

Now you can have the mean / sum / sd / whatever by country in your original data set.



sarah smith wrote:

Dear Stata users:

I have panel data for several industries in 40 countries for 20 years. For each year, I am trying to collapse the data by country. I tried to use foreach and forvalues commands, but could not work it out. I would appreciate if you can help me.

Thnks,
sarah





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