I HAVE the following data
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input double(date aaplp amznp) 21056 159.86 945.26 21059 161.47 946.02 21060 162.91 954.0601 21061 163.35 967.5901 21062 164 980.6001 21063 164.05 978.25 21066 164.05 978.25 21067 162.08 965.27 21068 161.91 967.8 21069 161.26 979.47 21070 158.63 965.8999 21073 161.5 977.96 21074 160.86 982.5801 21075 159.65 999.6001 21076 158.28 992.21 end format %td date
I WANT to reshape the above data in a way that I get the following results:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input double(date Price) str5 Name 21056 159.86 "aaplp" 21059 161.47 "aaplp" 21060 162.91 "aaplp" 21061 163.35 "aaplp" 21062 164 "aaplp" 21063 164.05 "aaplp" 21066 164.05 "aaplp" 21067 162.08 "aaplp" 21068 161.91 "aaplp" 21069 161.26 "aaplp" 21070 158.63 "aaplp" 21073 161.5 "aaplp" 21074 160.86 "aaplp" 21075 159.65 "aaplp" 21076 158.28 "aaplp" 21056 945.26 "amznp" 21059 946.02 "amznp" 21060 954.0601 "amznp" 21061 967.5901 "amznp" 21062 980.6001 "amznp" 21063 978.25 "amznp" 21066 978.25 "amznp" 21067 965.27 "amznp" 21068 967.8 "amznp" 21069 979.47 "amznp" 21070 965.8999 "amznp" 21073 977.96 "amznp" 21074 982.5801 "amznp" 21075 999.6001 "amznp" 21076 992.21 "amznp" end format %td date
P.S: In case if it helps, I import the data from excel. So when I import, I make that the first row is treated as the variable name. I can also make it so that the first row is treated as data.
Thanks
0 Response to Help regarding "reshape"
Post a Comment