I want to convert my wide data into a long panel data for currency data.
Currently the data looks like :
Type Date Australia Austria Belgium ........
Spot 01/01/1980 0.72 `1.25 2.5
Forward 01/01/1980 0.73 1.26 2.55
Spot 01/02/1980 0.75 `1.19 2.53
Forward 01/02/1980 0.76 1.20 2.57
I want the data to look in the following panel forward
Country Date Spot Forward
Australia 01/01/1980 0.72 0.73
Australia 01/02/1980 0.75 0.76
Austria 01/01/1980 1.25 1.26
Austria 01/02/1980 1.19 1.20
Belgium 01/01/1980 2.5 2.55
Belgium 01/02/1980 2.53 2.57
The -datex is below )not formated for number of spaces.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str7 type int date double(australia austria belgium brazil bulgaria) "Spot" 7549 .8564603240548401 12.652675529705027 28.707926879933527 0 . "Spot" 7579 .8506900878293601 12.80008364700962 28.954412379757425 0 . "Spot" 7610 .8532842234499693 13.585013300593413 30.673214651115206 0 . "Spot" 7640 .8595445839540328 13.749725473505002 31.142796339646736 0 . "Forward" 7671 . 13.237130907570053 31.681304893350063 . . "Spot" 7671 .8471350899205353 13.27896277708072 31.76495190296947 0 . "Spot" 7702 .8561089825457642 15.025542784163473 34.26990208599404 0 . "Forward" 9010 . 20.381811204911745 58.653100537221796 . . "Forward" 9040 . 21.392921212121212 61.84645656565656 . . "Spot" 9040 1.2042 21.462626262626262 61.838367676767675 0 . "Forward" 9071 . 21.05748987854251 60.08906072874494 . . "Spot" 9071 1.1743 21.121441295546557 60.08097165991902 0 . "Forward" 9101 . 21.75939014202172 62.552213868003335 . . "Spot" 9101 1.1685 21.791963241436925 62.48954887218044 0 . end format %td date
Thank you,
Afak Nazim
0 Response to Using Reshape to sort wide into long
Post a Comment