Hello, I just started using stata in my university and this simple yet too hard for me right now problem is bothering me.
I have to compute gdp growth rate but instead this time the data was sorted in unfamiliar format
It was a lot easier when data was sorted horizontally. However this time I have no clue.
For example,
I tried this but it created missing values
Thus, I couldn't do
It will be very much appreciated, if someone knows how to fix this.
Thank you
I have to compute gdp growth rate but instead this time the data was sorted in unfamiliar format
Code:
country after gdp_capita "aaaaaa" 0 2209 "aaaaaa" 1 3885 "bbbbbb" 0 3562 "bbbbbb" 1 4459 "cccccc" 0 2188
For example,
Code:
gen gdp_after = gdp_capita if after==1
Code:
gen gdp_before = gdp_capita if after==0
Code:
country after gdp_capita gdp_after gdp_before "aaaaaa" 0 2209 2209 "aaaaaa" 1 3885 3885 "bbbbbb" 0 3562 3562 "bbbbbb" 1 4459 4459 "cccccc" 0 2188
Code:
gen growth = (gdp_after - gdp_before)/gdp_before
Thank you
Comment