![]() |
||||||||||||||||||||||||||||||||||||||||||||||||
Using Stata's -reshape-
Command with Data Files
|
||||||||||||||||||||||||||||||||||||||||||||||||
|
Country
|
1981
|
1982
|
1983
|
|
Austria
|
25
|
10
|
8
|
|
Belgium
|
14
|
10
|
17
|
|
Denmark
|
2
|
18
|
4
|
For analysis in statistical packages, the data must be "reshaped" into the 'long' format, which means that the
rows denote country-years while the columns are variables of interest.
Example:
|
Country
|
Year
|
Variable
|
|
Austria
|
1981
|
25
|
|
Austria
|
1982
|
10
|
|
Austria
|
1983
|
8
|
|
Belgium
|
1981
|
14
|
|
Belgium
|
1982
|
30
|
|
Belgium
|
1983
|
17
|
|
Denmark
|
1981
|
2
|
|
Denmark
|
1982
|
18
|
|
Denmark
|
1983
|
4
|
In this introduction to using the -reshape-
command, we will look at two examples: one where we have a data file with
only one variable of interest, and one where we have a data file with
multiple variables of interest:
Reshaping Data With One Variable of Interest
Reshaping Data With Many Variables of Interest
Again, this guide is not a comprehensive, top-to-bottom review of the -reshape- command. It is more an introduction to the command and how it might be used with a particular resource. If you would like more assistance in using the command with your data, please feel free to contact the Data Center staff.
"FAQ: Problems With Reshape,"
by the Stata Corporation
"Reshape World Development
Indicators for Stata Analysis," by Data and Statistical Services, Princeton University
"Reshaping Panel Data Using Excel and Stata," by Moonhawk Kim at the University of Colorado, Boulder
"Reshaping a Data File," UNC Carolina Population Center
"Reshaping Data Long to Wide," UCLA Academic Technology Services
"Reshaping Data Wide to Long," UCLA Academic Technology Services
Home | Analyze Data Online | Help Resources | Contacts & Hours | Emory General Libraries