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]

st: reshape command


From   Safis-Moustafa Chatzouz <m.chatzouz@warwick.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: reshape command
Date   Mon, 10 Jun 2013 09:27:46 +0100

Hi,

I have the following data to reshape from wide to long

iso country subject unit scale v6 until v36 (those are years)
co1     country1    debt        index                        100
c02     country2    debt        index                        200
c03      country3    debt        index                        300
co1    country1        debt      dollars    billions    400
c02    country2        debt        dollars    billions    500
c03    country3        debt        dollars    billions    600
co1    country1        gdp      dollars    billions    400
c02    country2        gdp        dollars    billions    500
c03    country3        gdp       dollars    billions    600
co1    country1        gdp      index        units          400
c02    country2        gdp        index    units        500
c03    country3        gdp        index   units        600
co1    country1       popu     persons    millions              400
c02    country2        popu       persons   millions     500
c03    country3        popu      persons  millions        600


So i have this wide form with repeated subject and different scale or units and for each country there are different variables over time. What I want to do, is to covert it in long form in the following way

iso country year debt(index) debt(billions) gdp(index) gdp(millions) poulation etc etc ...
co1  country1           1980
co1  country1           1981
co1   country1          1983
co2  country2           1980
co2  country2           1981
co2  country2           1983

and so on.

Can someone here help me with this please? I will highly appreciate it.

Many thanks

--
Safis-Moustafa Chatzouz
Phd Candidate in Economics
University of Warwick
Email: m.chatzouz@warwick.ac.uk


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


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index