I would like to convert wide to long format to create a panel data set, so that each 'Country' has 'month' variable '198501', '198502', 198503, .... 200203.
Here the X'01' means X'January', X02 is X'Febuary', and so on.
Here is a part of the dataset (I cut some because it is very long)
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str4 year str30 Country double(X01 X02 X03) "1985" "OPEC" 700 612 97 "1986" "OPEC" 1684 1044 703 "1987" "OPEC" 605 1073 665 "1988" "OPEC" 767.3 1097.6 571 "1989" "OPEC" 967.6000000000001 858.4000000000001 1136.5 "1990" "OPEC" 2638.5 1962.8999999999999 1890.8000000000002 "1991" "OPEC" 1978.6 1226.3999999999999 856.5 "1992" "OPEC" 760.3 387.60000000000014 409.3000000000002 "1993" "OPEC" 1123.3 974 1049.2 "1994" "OPEC" 360.2000000000003 647.3000000000002 683.4000000000001 "1995" "OPEC" 848.1000000000001 1373.6000000000001 1423.8000000000002 "1996" "OPEC" 1767.8 1237.4 1020.2 "1997" "OPEC" 2343 1551.8 1327 "1998" "OPEC" 876 612.3 432 "1999" "OPEC" 1008.5 428.2000000000003 659.6000000000004 "2000" "OPEC" 2897.4 3121.4 3996.3999999999996 "2001" "OPEC" 4088.1000000000004 3298.2999999999997 3355.5 "2002" "OPEC" 2495.1 1949.8999999999999 2466.8999999999996 end
Thank you always for your help!!
0 Response to Convert wide to long format
Post a Comment