Stata Tutorial: Panel Data Formatting with the "reshape" command
HTML-код
- Опубликовано: 21 авг 2024
- Using example data from the World Bank we show how to transform a "wide" format panel to a "long" format panel in Stata using the "reshape" command.
Link to "Gentle Introduction to Stata"
www.amazon.com...
Link to the excellent Introduction to Econometrics Textbook by AH Studenmund:
www.amazon.com...
Link to Jeffrey Wooldridge Introductory Econometrics Textbook:
www.amazon.com...
Literal life saver thank you so much!
How can I do the same exercise with more than one variables? I have the same worldbank data but including GDP per capita and GDP in constant prices. Thanks!
Hi Mike, Thanks for the video. Is there any video available for multilevel mixed effect linear regression model in STATA please :)
If you're trying to go from Long to Wide.. and receive this error... what can I do
values of variable year not unique within sid stateid
Your data are currently long. You are performing a reshape wide. You specified i(sid stateid) and j(year). There are
observations within i(sid stateid) with the same value of j(year). In the long data, variables i() and j() together must
uniquely identify the observations.
Thanks, very clear!
Thank you a lot
this was so useful! thank you!
Thank you very much for this tutorial! It helped a lot :)
useful video. thanks.
'command bbopendata is unrecognized'. maybe i should have added something that is not mentioned here, before running the command? how can I proceed?
Hi, thanks for the tutorial. I have more complex data from UNCTAD GVC data. it has no year but 184 countries with 26 sectors attached to it. how do i reshape such data from wide to long?
Good Question! The command is the same, but instead of a time indicator, the j(..) will contain the sector code. So each country will appear in 26 rows, one for each sector. Let me know if that works for you.
I want to draw time graphs with panel data. For example I have a patient who had a procedure on Jan12024 and then on Jan 2, his pain score was 2, on Jan 3, his pain score was 6 and jan 10, his pain score was 12 . Let’s assume I have 100 patients, 50 who had the procedure and 50 did not. And so I want to draw time wise graphs for cumulative pain scores on days 1,2,3…….for both patient types in different colors. Is it possible to know this from you. I know I will have to calculate the days on my own which I can do
By the way…excellent stuff. I subscribed you
Hey thanks a lot for the video, what do we do if the name of the year is not yr + year but just D, E, F and so on?
What if we dont have year variable? It's in the same year
For it to be panel / longitudinal data, there will be a “time” or “date” variable to play this role. If all observations are from the same time period, it will be cross-sectional data, and the reshape command will not be necessary.