I have been trying to transpose Datastream data by date. I know how to do this in SAS but I am having trouble replicating this on STATA. I have provided a dataex sample below
* Example generated by -dataex-. To install: ssc install dataex
clear
input float(date uk australia brazil bulgaria)
-1065 2.7982 . . .
-1037 2.7975 . . .
-1008 2.7875 . . .
-976 2.7912 . . .
-945 2.7918 . . .
-917 2.7912 . . .
-884 2.785 . . .
-854 2.7832 . . .
-823 2.7956 . . .
-792 2.7968 . . .
-763 2.8062 . . .
-731 2.8594 . . .
-700 2.8162 . . .
-672 2.8162 . . .
-641 2.8162 . . .
-611 2.8182 . . .
-581 2.8168 . . .
-550 2.8032 . . .
-519 2.805 . . .
-490 2.8018 . . .
-458 2.8068 . . .
-427 2.8062 . . .
-399 2.8044 . . .
-366 2.8025 . . .
-336 2.8094 . . .
-308 2.8055 . . .
-276 2.8162 . . .
-246 2.8162 . . .
-217 2.8118 . . .
-185 2.8138 . . .
-154 2.8112 . . .
-123 2.8056 . . .
-93 2.8044 . . .
-63 2.8056 . . .
-32 2.8018 . . .
-1 2.8 . . .
28 2.8025 . . .
59 2.8038 . . .
90 2.8075 . . .
119 2.8088 . . .
151 2.8025 . . .
181 2.8069 . . .
210 2.8089 . . .
243 2.8113 . . .
273 2.8106 . . .
304 2.8156 . . .
334 2.8106 . . .
364 2.8038 . . .
396 2.8044 . . .
424 2.7956 . . .
455 2.7975 . . .
483 2.7962 . . .
516 2.7919 . . .
546 2.7881 . . .
577 2.795 . . .
608 2.8056 . . .
637 2.8144 . . .
669 2.815 . . .
699 2.8125 . . .
728 2.8081 . . .
761 2.8119 . . .
789 2.815 . . .
819 2.8138 . . .
850 2.8125 . . .
881 2.81 . . .
910 2.8088 . . .
942 2.805 . . .
973 2.8019 . . .
1001 2.8012 . . .
1034 2.8012 . . .
1064 2.8031 . . .
1095 2.8025 . . .
1126 2.8044 . . .
1154 2.8025 . . .
1183 2.7995 . . .
1215 2.8006 . . .
1246 2.8002 . . .
1274 2.8009 . . .
1307 2.8007 . . .
1337 2.7979 . . .
1368 2.7977 . . .
1399 2.7981 . . .
1428 2.7973 . . .
1460 2.7966 . . .
1491 2.7978 . . .
1519 2.7982 . . .
1551 2.7984 . . .
1581 2.7999 . . .
1610 2.7979 . . .
1642 2.7917 . . .
1673 2.7882 . . .
1704 2.7839 . . .
1734 2.7833 . . .
1764 2.785 . . .
1795 2.7912 . . .
1826 2.7901 1.1118151 . .
1855 2.792 1.1120847 . .
1883 2.7941 1.1135865 . .
1916 2.7905 1.1125064 . .
1946 2.7991 1.1139809 . .
end
I am trying to transpose the data so that the data is sorted by date and there is an ID called 'country' for the column variables which are currently listed as country names. This is how the datastream currency data appears in wide form. I tried doing this using the reshape long command but nothing seems to work. I've also uploaded the raw dataset in csv form if one needs more info about the dataset.
Thank you in advance.
0 Response to Reshaping Datastream Data (Currency) for Stata
Post a Comment