Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Alice Guerra <alice.guerra88@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | st: Add new observations in the dataset |
Date | Fri, 19 Jul 2013 11:25:52 +0200 |
Dear Statalists, I have a panel dataset that looks as follows: year city x1 2008 Ancona 5 2008 Bari 1 2009 Ancona 8 2009 Bari 3 2010 Ancona 9 2010 Bari 8 I would like to add for each year a new observation "Italy" whose x1' values are the sum of the x1's values of Italian cities: year city x1 2008 Ancona 5 2008 Bari 1 2008 ITALY 6 2009 Ancona 8 2009 Bari 3 2009 ITALY 11 2010 Ancona 9 2010 Bari 8 2010 ITALY 17 Is there a direct way to obtain this result or I have to use collapse, save the dta with only Italy, and append it to the complete dta? Thank you fot your time and assistance Best regards Alice * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/