Goodmorning,
I have a wide layout:
I would like to apply fama macbeth regression and therefore my data as a panel will be more straightforward. thus I woud like to a long layout.
reshape function should do the trick.
I am slight confused how to tackle this problem though. Stata states that my data is already in a long format..
date in months are are the monthly dates
mktrf,smb,hml,cma,rmw are return for factors on a monthly basis
excess_food , excess_beer are returns on a monthly basis for that industry.
here is my data:
. dataex date_in_months MKTRF SMB HML CMA RMW RF excess_food excess_beer
----------------------- copy starting from the next line -----------------------
------------------ copy up to and including the previous line ------------------
Listed 100 out of 438 observations
Use the count() option to list more
regards,Wes
I have a wide layout:
I would like to apply fama macbeth regression and therefore my data as a panel will be more straightforward. thus I woud like to a long layout.
reshape function should do the trick.
I am slight confused how to tackle this problem though. Stata states that my data is already in a long format..
date in months are are the monthly dates
mktrf,smb,hml,cma,rmw are return for factors on a monthly basis
excess_food , excess_beer are returns on a monthly basis for that industry.
here is my data:
. dataex date_in_months MKTRF SMB HML CMA RMW RF excess_food excess_beer
----------------------- copy starting from the next line -----------------------
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float date_in_months double(MKTRF SMB HML) str6(CMA RMW) double RF float(excess_food excess_beer) 228 4.23 3.84 2.29 "-2.5" "1.58" .77 2.27 5.86 229 -3.56 .53 1.21 "-1.15" "1.04" .73 -4.76 -4.62 230 5.68 3.18 -.7 "0.7" "0.28" .81 1.6 7.2 231 -.06 2.4 1.05 "1.18" "0.21" .8 -1.27 1.44 232 -2.21 .47 1.93 "-0.88" "-0.83" .82 -2.22 -5.48 233 3.85 .98 1.5 "-1.71" "-0.45" .81 2.37 5.26 234 .8199999999999998 1.28 1.69 "-0.16" "0.59" .77 .12 -.02 235 5.53 1.94 -1.54 "1.51" "-1.47" .77 5.98 10.92 236 -.8199999999999998 -.32 -.91 "0.86" "0.52" .83 -2.61 -1.86 237 -8.1 -3.48 -1.87 "1.01" "0.22" .87 -9.22 -10.46 238 5.21 2.42 -3.23 "0.13" "-2" .99 3.91 6.93 239 1.79 4.38 -2 "-0.65" "-0.99" .95 1.17 3.25 240 5.51 1.93 1.81 "-1.86" "2" .8 2.21 10.24 241 -1.22 -1.61 .67 "-1.12" "3.06" .89 -6.65 -3.19 242 -12.9 -6.92 -1.08 "1.79" "-1.34" 1.21 -9.45 -14.64 243 3.9699999999999998 .96 1.14 "-2.1" "0.57" 1.26 6.2 3.05 244 5.26 2.15 .41 "0.48" "-0.5" .81 7.05 8.95 245 3.06 1.48 -.89 "-0.06" "-0.96" .61 1.44 3.12 246 6.49 3.92 -6.37 "3.96" "-2.49" .53 4.76 8.49 247 1.8000000000000003 4.27 -2.64 "2.05" "-0.8" .64 -.46 .62 248 2.19 .56 -4.72 "1.86" "-2.81" .75 -1.53 .31 249 1.06 2.28 -2.78 "1.6" "-1.3" .95 -2.13 -.48 250 9.59 -3.39 -8.4 "4.22" "-5.74" .96 -1.25 -.78 251 -4.52 -.29 2.69 "-1.1" "1.19" 1.31 1.79 -5.38 252 -5.04 3.38 6.86 "-3.49" "4.37" 1.04 1.27 3.52 253 .57 -.44 .99 "0.22" "2.27" 1.07 1.21 2.1 254 3.56 3.16 .66 "-2.37" "-0.45" 1.21 5.73 6.75 255 -2.11 4.59 2.27 "0.88" "1.2" 1.08 -1.05 -3.13 256 .11 2.43 -.42 "0.3" "-1.61" 1.15 1.59 .13 257 -2.36 -.96 5.13 "-1.4" "2.7" 1.35 -2.29 -.75 258 -1.54 -2 -.6 "1.07" "-3.03" 1.24 -2.32 -2.32 259 -7.04 -1.8 4.86 "-0.26" "1.47" 1.28 -6.22 -7 260 -7.17 -2.54 5.2 "-0.02" "2.8" 1.24 -3.27 -1.87 261 4.92 2.26 -4.2 "3.29" "-2.81" 1.21 7.77 7.06 262 3.36 -1.4 1.9 "0.26" "0.6" 1.07 .68 2.29 263 -3.65 1.17 .74 "0.32" "2.38" .87 -.55 -3.02 264 -3.2400000000000007 -1.36 3.17 "-1.44" "2.08" .8 -1.32 1.04 265 -5.86 .34 6.08 "-3.46" "4.54" .92 -1.64 -2.47 266 -1.87 -.04 3.78 "-1.48" "2.36" .98 2.19 3.75 267 3.27 1.15 -2.78 "1.62" "-0.17" 1.13 5.26 8.79 268 -3.9900000000000007 .56 1.82 "0.77" "-0.07" 1.06 -3.54 -3.56 269 -3.09 -.53 1.56 "-0.1" "2.69" .96 1.12 1.19 270 -3.19 .95 .17 "1.1" "1.56" 1.05 -.45 7.62 271 11.14 -4.28 1.18 "-1.91" "0.22" .76 6.4 3.29 272 1.29 2.57 .33 "2.14" "-0.07" .51 2.97 5.67 273 11.3 1.92 -3.71 "0.46" "-0.36" .59 6.52 6.38 274 4.67 4.51 -1.98 "-0.74" "0.32" .63 3.93 6.43 275 .55 .01 .04 "-0.15" "1.09" .67 .47 -4.62 276 3.6000000000000005 3.31 -.83 "-1.44" "-0.5" .69 -1.33 .96 277 2.59 2.94 .72 "-0.68" "1.03" .62 .48 4.06 278 2.82 1.42 2.08 "-0.01" "2.83" .63 4.95 10.58 279 6.67 .48 .62 "-0.2" "1.58" .71 4.53 4.67 280 .52 6.19 -1.41 "-1.84" "-1.59" .69 -1.39 -4 281 3.07 1.15 -3.92 "2.29" "-0.92" .67 .67 -.68 282 -4.07 .98 5.65 "-0.15" "2.86" .74 -3.29 -1.1 283 -.5 -4.32 5.55 "0.5" "1.96" .76 1.27 2.46 284 .91 .28 1.12 "1.15" "0.61" .76 4.48 3.96 285 -3.44 -3.82 5.08 "-0.75" "2.97" .76 2.72 -3.49 286 2.16 1.89 -.62 "-0.58" "0.66" .7 2.64 -4.17 287 -1.78 -.46 1.66 "1.51" "1.18" .73 -.7 -3.41 288 -1.92 -.09 7.6 "-1" "2.98" .76 .59 -2.35 289 -4.82 -1.61 3.35 "0.84" "1.56" .71 -4.82 -8.1 290 .63 -.29 .49 "-0.91" "1.1" .73 .95 -2.21 291 -.51 -1.02 1.29 "3.28" "0.75" .81 -.5 -1.28 292 -5.97 .11 .26 "2.26" "-0.48" .78 -2.84 -1.04 293 1.82 .08 -2.62 "3.08" "-1.51" .75 5.96 .02 294 -2.74 -2.25 .49 "3.69" "-2.09" .82 -1.83 -3.69 295 10.28 -.28 -1.85 "-0.87" "-0.89" .83 6.51 5.03 296 -.8 0 5.33 "1.45" "2.49" .86 1.98 .17 297 -.84 -1.46 .5 "1.28" "-1.28" 1 .72 3.72 298 -1.76 -.97 4.08 "0.84" "2.1" .73 -1 -.84 299 1.8399999999999999 -.69 -.16 "1.23" "-1.28" .64 1.93 .91 300 7.99 3.5 -5.44 "-0.85" "-3.38" .65 .14 4.61 301 1.22 .99 -.11 "1.38" "1.02" .58 5.49 .85 302 -.84 -1.52 4.1 "1.21" "2.97" .62 6.34 3.66 303 -.96 -.1 3.73 "1.48" "0.83" .72 -2.52 .75 304 5.09 -2.32 -.85 "1.3" "-1.46" .66 10.88 7.79 305 1.27 .44 .62 "1.55" "-0.63" .55 2.68 3.13 306 -.74 2.96 -1.68 "-0.52" "0.33" .62 -3.52 .56 307 -1.02 -.34 2.27 "0.02" "1.72" .55 2.13 1.7 308 -4.54 -1.79 1.33 "1.2" "1.86" .6 3.92 -1.35 309 4.02 -1.54 .79 "0.79" "-1.13" .65 3.33 4.99 310 6.480000000000001 .02 -2.93 "0.35" "-2.15" .61 9.69 1.82 311 3.88 -.36 -1.59 "0.85" "-1.14" .65 2.03 11.43 312 .65 .96 .55 "-1.97" "-2.47" .56 1.01 -1.42 313 7.13 -.8 -.93 "1.08" "-2.16" .53 8.77 7.18 314 4.88 -.59 -.44 "1.32" "0.59" .6 7.88 8.57 315 -1.31 2.96 -2.93 "3.01" "0.48" .52 .72 -3.44 316 4.62 -1.33 -.11 "2.09" "0.43" .49 7.48 5.88 317 1.03 -.86 1.41 "1.75" "0.62" .52 6.18 8.29 318 -6.45 -3.52 4.84 "-0.78" "0.61" .52 -5.54 -3.51 319 6.07 -4.37 3.48 "-1.58" "3.23" .46 2.33 -1.89 320 -8.6 1.97 3.22 "-0.12" "3.62" .45 -12.66 -8.55 321 4.66 -2.26 -1.23 "0.15" "0.9" .46 10.42 7.09 322 1.17 -1.89 -.08 "1.11" "0.6" .39 .13 .41 323 -3.27 .08 .33 "0.98" "-0.09" .49 -3.45 -2.78 324 12.47 -1.52 -3.17 "0.22" "-1.15" .42 12.11 21.6 325 4.39 3.41 -5.98 "-0.79" "-2.76" .43 3.99 2.92 326 1.6399999999999997 .21 1.59 "1.31" "4.06" .47 1.8 .39 327 -2.11 -1.56 -.31 "-0.48" "1.14" .44 -6.17 3.77 end format %tm date_in_months
Listed 100 out of 438 observations
Use the count() option to list more
regards,Wes
Comment