Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

st: reshape command

From   Safis-Moustafa Chatzouz <>
To   <>
Subject   st: reshape command
Date   Mon, 10 Jun 2013 09:27:46 +0100


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

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index