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 on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: summation of values within one column in a panel dataset


From   John Ataguba <johnataguba@yahoo.co.uk>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: summation of values within one column in a panel dataset
Date   Sun, 1 Aug 2010 08:11:55 +0000 (GMT)

Try

egen profit2=sum(profit), by(date)

   
 Jon 

________________________________
From: "rado645-bg@yahoo.de" <rado645-bg@yahoo.de>
To: statalist@hsphsun2.harvard.edu
Sent: Sun, 1 August, 2010 6:46:34
Subject: st: summation of values within one column in a panel dataset

I have a panel dataset and I wonder if it is possible to generate in  Stata a 
new variable that is the sum of observations for a  variable for two of my 
panels only (ie it is a summation of values  within one column).

example: my panels are companies A,B,C.... and I have quarterly observations on 
profits, revenues, etc. 


Date    company    profits

comp    profit        date
A             120        2000
A            320      2001
B            102       2000
B            101        2001
C           156        2000
C            136        2001


Since company A and B merged in 1999, I need to use the sum of their profits for 


my analysis in years 2000 and 2001. So I need to build a new variable A+B:

comp    profit        date
A+B       122       2000
A+B       421         2001

Is there a command for panel dataset  in Stata that allows me to do  such data 
manipulation (panels are  unbalanced, btw)? Unfortunately, I couldn't find any 
information in the  manuals and on internet. Many thanks in advance!

Best regards,
Radovan



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