Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • calculating the return using quarterly prices

    Dears,

    I have a huge dataset, I want the code to calculate the return using this interval ( 2 days after the previous announcement date, and 1 day after the current announcement date). The data is quarterly, and defined as follows


    PERMNO: Firm id
    PRC: price
    fyearq: Fiscal Year
    fqtr: Fiscal Quarter
    rdq: announcement date (below it appears a number but it is a date in the original file that I have like this "21aug2001"

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input double(PERMNO PRC fyearq fqtr) long rdq
    
    10001 10.149999618530273 . . .
    10001 9.899999618530273 . . .
    10001 9.899999618530273 . . .
    10001 9.899999618530273 . . .
    10001 9.899999618530273 . . .
    10001 -9.824999809265137 . . .
    10001 -9.800000190734863 . . .
    10001 10.199999809265137 . . .
    10001 9.75 . . .
    10001 10.100000381469727 . . .
    10001 10.100000381469727 . . .
    10001 9.899999618530273 . . .
    10001 10.100000381469727 . . .
    10001 9.699999809265137 . . .
    10001 9.75 . . .
    10001 9.850000381469727 . . .
    10001 9.850000381469727 . . .
    10001 10 . . .
    10001 9.720000267028809 . . .
    10001 9.800000190734863 . . .
    10001 9.699999809265137 . . .
    10001 9.949999809265137 . . .
    10001 9.75 . . .
    10001 9.949999809265137 . . .
    10001 9.949999809265137 . . .
    10001 9.979999542236328 . . .
    10001 9.989999771118164 . . .
    10001 10.5 . . .
    10001 10.489999771118164 . . .
    10001 10.489999771118164 . . .
    10001 10.420000076293945 . . .
    10001 10.5 . . .
    10001 11.25 . . .
    10001 11 . . .
    10001 10.5 . . .
    10001 10.75 . . .
    10001 10.699999809265137 . . .
    10001 10.75 . . .
    10001 10.649999618530273 . . .
    10001 11.5 . . .
    10001 -10.795000076293945 . . .
    10001 10.5 . . .
    10001 11.25 . . .
    10001 11 . . .
    10001 11.25 . . .
    10001 11.5 . . .
    10001 11 . . .
    10001 11 . . .
    10001 11.25 . . .
    10001 11.5 . . .
    10001 11.5 . . .
    10001 13 . . .
    10001 12.5 . . .
    10001 11.5 . . .
    10001 11.989999771118164 . . .
    10001 11.520000457763672 . . .
    10001 11.520000457763672 . . .
    10001 11.800000190734863 . . .
    10001 11.75 . . .
    10001 12.199999809265137 . . .
    10001 11.920000076293945 . . .
    10001 11.920000076293945 . . .
    10001 11.6899995803833 . . .
    10001 11.800000190734863 . . .
    10001 12 . . .
    10001 12 . . .
    10001 11.800000190734863 . . .
    10001 11.800000190734863 . . .
    10001 11.739999771118164 . . .
    10001 11.5 . . .
    10001 11 . . .
    10001 -11.25 . . .
    10001 9.300000190734863 . . .
    10001 10.449999809265137 . . .
    10001 10.850000381469727 . . .
    10001 12.34000015258789 . . .
    10001 12.25 . . .
    10001 12.25 . . .
    10001 12.100000381469727 . . .
    10001 12 . . .
    10001 12 . . .
    10001 12.100000381469727 . . .
    10001 12 . . .
    10001 12.390000343322754 . . .
    10001 12.25 . . .
    10001 12.25 . . .
    10001 12.050000190734863 . . .
    10001 12.149999618530273 . . .
    10001 12.239999771118164 . . .
    10001 12.25 . . .
    10001 12.199999809265137 . . .
    10001 12.25 . . .
    10001 12.29699993133545 . . .
    10001 12.199999809265137 . . .
    10001 12.319999694824219 . . .
    10001 12.350000381469727 . . .
    10001 12.489999771118164 . . .
    10001 12.449999809265137 . . .
    10001 12.25 . . .
    10001 12.25 . . .
    10001 12.248499870300293 . . .
    10001 12.350000381469727 . . .
    10001 12.399999618530273 . . .
    10001 12.600000381469727 . . .
    10001 12.5 . . .
    10001 12.399999618530273 . . .
    10001 12.498000144958496 . . .
    10001 12.300000190734863 . . .
    10001 12.609999656677246 . . .
    10001 12.3100004196167 . . .
    10001 12.550000190734863 . . .
    10001 12 . . .
    10001 12.350000381469727 . . .
    10001 12.729999542236328 . . .
    10001 12.699999809265137 . . .
    10001 12.593999862670898 . . .
    10001 11.949999809265137 . . .
    10001 12.399999618530273 . . .
    10001 12.25 . . .
    10001 12.300000190734863 . . .
    10001 11.920000076293945 . . .
    10001 11.399999618530273 . . .
    10001 12 . . .
    10001 11.75 . . .
    10001 10.866800308227539 . . .
    10001 10.799500465393066 . . .
    10001 11.449999809265137 . . .
    10001 11.5 . . .
    10001 11.005000114440918 . . .
    10001 11.490099906921387 . . .
    10001 10.5 . . .
    10001 11.119999885559082 . . .
    10001 11.496600151062012 . . .
    10001 11.149999618530273 . . .
    10001 11.496999740600586 . . .
    10001 11.458999633789063 . . .
    10001 11.329999923706055 . . .
    10001 11.5 . . .
    10001 11.520000457763672 . . .
    10001 11.550000190734863 . . .
    10001 11.51830005645752 . . .
    10001 11.350000381469727 . . .
    10001 11.5 . . .
    10001 11.5 . . .
    10001 11.220000267028809 . . .
    10001 11.510000228881836 . . .
    10001 11.300000190734863 . . .
    10001 11.498499870300293 . . .
    10001 11.5 . . .
    10001 11.289999961853027 . . .
    10001 11.289999961853027 . . .
    10001 11.399999618530273 . . .
    10001 11.399999618530273 . . .
    10001 11.449999809265137 . . .
    10001 11.44849967956543 . . .
    10001 11.399999618530273 . . .
    10001 11.449999809265137 . . .
    10001 11.489999771118164 . . .
    10001 11.489999771118164 . . .
    10001 11.5 . . .
    10001 11.5 . . .
    10001 11.25 . . .
    10001 11.449999809265137 . . .
    10001 11.130000114440918 . . .
    10001 11.119999885559082 . . .
    10001 11.25 . . .
    10001 11.449999809265137 . . .
    10001 11.5 . . .
    10001 11.5 . . .
    10001 11.5 . . .
    10001 11.5 . . .
    10001 11.5 . . .
    10001 11.449999809265137 . . .
    10001 11.449999809265137 . . .
    10001 11.300000190734863 . . .
    10001 11.489999771118164 . . .
    10001 11.489999771118164 . . .
    10001 11.199999809265137 . . .
    10001 11.202500343322754 . . .
    10001 11.449999809265137 . . .
    10001 11.449999809265137 . . .
    10002 8.875 . . .
    10002 9.5 . . .
    10002 9.5 . . .
    10002 -9.1875 . . .
    10002 8.625 . . .
    10002 -9.1875 . . .
    10002 -9.0625 . . .
    10002 9.5 . . .
    10002 8.3125 . . .
    10002 8.75 . . .
    10002 9 . . .
    10002 9 . . .
    10002 9.25 . . .
    10002 9.5 . . .
    10002 9.75 . . .
    10002 9.9375 . . .
    10002 10.5 . . .
    10002 10.25 . . .
    10002 10 . . .
    10002 10.5 . . .
    10002 10 . . .
    10002 10.25 . . .
    10002 -10.5 . . .
    10002 10.875 . . .
    10002 11 . . .
    10002 11 . . .
    10002 11 . . .
    10002 11.375 . . .
    10002 11.5625 . . .
    10002 11.6875 . . .
    10002 11.3125 . . .
    10002 11.5 . . .
    10002 11.4375 . . .
    10002 11.1875 . . .
    10002 11 . . .
    10002 10.3125 . . .
    10002 10.875 . . .
    10002 10.875 . . .
    10002 10.625 . . .
    10002 10.625 . . .
    10002 10.625 . . .
    10002 10.75 . . .
    10002 11 . . .
    10002 10.875 . . .
    10002 -10.625 . . .
    10002 10.875 . . .
    10002 10.875 . . .
    10002 10.5 . . .
    10002 10 . . .
    10002 10 . . .
    10002 10 . . .
    10002 10.5 . . .
    10002 -10.375 . . .
    10002 10.375 . . .
    10002 10 . . .
    10002 10 . . .
    10002 10.25 . . .
    10002 10.5 . . .
    10002 11.375 . . .
    10002 12 . . .
    10002 12.5 . . .
    10002 15 . . .
    10002 13.25 . . .
    10002 13.875 . . .
    10002 13.375 . . .
    10002 13.75 . . .
    10002 14 . . .
    10002 14.25 . . .
    10002 14.470000267028809 . . .
    10002 14.75 . . .
    10002 14.289999961853027 . . .
    10002 14.5 . . .
    10002 14 . . .
    10002 13.180000305175781 . . .
    10002 -13.514999389648438 . . .
    10002 -13.414999961853027 . . .
    10002 13.75 . . .
    10002 11.75 . . .
    10002 11 . . .
    10002 11.289999961853027 . . .
    10002 11.5 . . .
    10002 11.380000114440918 . . .
    10002 -11.440000534057617 . . .
    10002 11.5 . . .
    10002 11.449999809265137 . . .
    10002 11.399999618530273 . . .
    10002 11.489999771118164 . . .
    10002 11.489999771118164 . . .
    10002 11.489999771118164 . . .
    10002 11.729999542236328 . . .
    10002 11.550000190734863 . . .
    10002 11 . . .
    10002 11.489999771118164 . . .
    10002 11.489999771118164 . . .
    10002 11.25 . . .
    10002 11.25 . . .
    10002 11.260000228881836 . . .
    10002 11.350000381469727 . . .
    10002 -11.430000305175781 . . .
    10002 11.489999771118164 . . .
    10002 11.489999771118164 . . .
    10002 11.489999771118164 . . .
    10002 11.489999771118164 . . .
    10002 11 . . .
    10002 -11.114999771118164 . . .
    10002 11.199999809265137 . . .
    10002 -11.100000381469727 . . .
    10002 11.199999809265137 . . .
    10002 11.229999542236328 . . .
    10002 11.100000381469727 . . .
    10002 10.510000228881836 . . .
    10002 10.380000114440918 . . .
    10002 -10.350000381469727 . . .
    10002 10.270000457763672 . . .
    10002 10.25 . . .
    10002 10.199999809265137 . . .
    10002 10.75 . . .
    10002 11.010000228881836 . . .
    10002 10.5 . . .
    10002 11.25 . . .
    10002 -11.399999618530273 . . .
    10002 -11.399999618530273 . . .
    10002 11.25 . . .
    10002 -10.925000190734863 . . .
    10002 11.300000190734863 . . .
    10002 11.3100004196167 . . .
    10002 -11.199999809265137 . . .
    10002 -11.199999809265137 . . .
    10002 11 . . .
    10002 10.510000228881836 . . .
    10002 10.899999618530273 . . .
    10002 10.75 . . .
    10002 10 . . .
    10002 10.5 . . .
    10002 10.800000190734863 . . .
    10002 10.600000381469727 . . .
    10002 10.5 . . .
    10002 10.550000190734863 . . .
    10002 -10.475000381469727 . . .
    10002 10.869999885559082 . . .
    10002 10.989999771118164 . . .
    10002 10.579999923706055 . . .
    10002 -10.800000190734863 . . .
    10002 -10.800000190734863 . . .
    10002 11 . . .
    10002 10.890000343322754 . . .
    10002 11.130000114440918 . . .
    10002 11.125 . . .
    10002 11 . . .
    10002 -10.949999809265137 . . .
    10002 -10.949999809265137 . . .
    10002 10.550000190734863 . . .
    10002 10.75 . . .
    10002 10.899999618530273 . . .
    10002 -10.774999618530273 . . .
    10002 10.699999809265137 . . .
    10002 10.539999961853027 . . .
    10002 10.5 . . .
    10002 10.5 . . .
    10002 10.600000381469727 . . .
    10002 10.6899995803833 . . .
    10002 11.029999732971191 . . .
    10002 10.880000114440918 . . .
    10002 10.670000076293945 . . .
    10002 10.579999923706055 . . .
    10002 10.670000076293945 . . .
    10002 -10.585000038146973 . . .
    10002 -10.585000038146973 . . .
    10002 10.350000381469727 . . .
    10002 -10.489999771118164 . . .
    10002 -10.514999389648438 . . .
    10002 10.630000114440918 . . .
    10002 10.420000076293945 . . .
    10002 -10.524999618530273 . . .
    10002 10.199999809265137 . . .
    10002 10 . . .
    10002 10.100000381469727 . . .
    10002 9.5 . . .
    10002 9.5 . . .
    10002 10.170000076293945 . . .
    10002 -10.09000015258789 . . .
    10002 9.75 . . .
    10002 -10.325000762939453 . . .
    10002 9.75 . . .
    10002 -10.690000534057617 . . .
    10002 -10.690000534057617 . . .
    10002 10.5 . . .
    10002 9.8100004196167 . . .
    10002 9.800000190734863 . . .
    10002 9.8100004196167 . . .
    10002 -10.065000534057617 . . .
    10002 10.15999984741211 . . .
    10002 10 . . .
    10002 -10.114999771118164 . . .
    10002 -10.074999809265137 . . .
    10002 -10.074999809265137 . . .
    10002 -10.130000114440918 . . .
    10002 10 . . .
    10002 10 . . .
    10002 -10.114999771118164 . . .
    10002 -10.114999771118164 . . .
    10002 -10.114999771118164 . . .
    10002 -10.114999771118164 . . .
    10002 9.25 . . .
    10002 9 . . .
    10002 9.5 . . .
    10002 9.4399995803833 . . .
    10002 9.5 . . .
    10002 9.079999923706055 . . .
    10002 9.199999809265137 . . .
    10002 9.079999923706055 . . .
    10002 9.100000381469727 . . .
    10002 9.199999809265137 . . .
    10002 9.199999809265137 . . .
    10002 9.5 . . .
    10002 9.399999618530273 . . .
    10002 9.199999809265137 . . .
    10002 9.649999618530273 . . .
    10002 -9.364999771118164 . . .
    10002 9.609999656677246 . . .
    10002 9.199999809265137 . . .
    10002 9.1899995803833 . . .
    10002 -9.375 . . .
    10002 9.649999618530273 . . .
    10002 9.5 . . .
    10002 9.699999809265137 . . .
    10002 9.699999809265137 . . .
    10002 10 . . .
    10002 9.619999885559082 . . .
    10002 9.75 . . .
    10002 9.75 . . .
    10002 9.989999771118164 . . .
    10002 9.649999618530273 . . .
    10002 9.649999618530273 . . .
    10002 10 . . .
    10002 -9.975000381469727 . . .
    10002 -9.975000381469727 . . .
    10002 9.350000381469727 . . .
    10002 9.619999885559082 . . .
    10002 9.649999618530273 . . .
    10002 9.319999694824219 . . .
    10002 9.319999694824219 . . .
    10002 -9.649999618530273 . . .
    10002 -9.649999618530273 . . .
    10002 9.800000190734863 . . .
    10002 9.800000190734863 . . .
    10002 9.5 . . .
    10002 9.890000343322754 . . .
    10012 2.34375 . . .
    10012 2.75 . . .
    10012 2.75 . . .
    10012 2.625 . . .
    10012 2.4375 . . .
    10012 2.3125 . . .
    10012 2.3125 . . .
    10012 2.5 . . .
    10012 2.65625 . . .
    10012 2.625 . . .
    10012 2.6875 . . .
    10012 2.6875 . . .
    10012 2.875 . . .
    10012 2.90625 . . .
    10012 3.3125 . . .
    10012 3.375 . . .
    10012 3.375 . . .
    10012 3.3125 . . .
    10012 3.25 . . .
    10012 3.125 . . .
    10012 3 . . .
    10012 3.0625 . . .
    10012 2.90625 . . .
    10012 2.5 . . .
    10012 2.5 . . .
    10012 2.53125 . . .
    10012 2.53125 . . .
    10012 2.5625 . . .
    10012 2.375 . . .
    10012 2.375 . . .
    10012 2.34375 . . .
    10012 2.34375 . . .
    10012 2.4375 . . .
    10012 2.21875 . . .
    10012 2.0625 . . .
    10012 2.0625 . . .
    10012 2.03125 . . .
    10012 2 . . .
    10012 2.125 . . .
    10012 2 . . .
    10012 1.96875 . . .
    10012 2 . . .
    10012 2 . . .
    10012 2.0625 . . .
    10012 2.125 . . .
    10012 2.09375 . . .
    10012 2.0625 . . .
    10012 1.875 . . .
    10012 1.875 . . .
    10012 1.9375 . . .
    10012 1.875 . . .
    10012 1.875 . . .
    10012 1.78125 . . .
    10012 1.5625 . . .
    10012 1.5625 . . .
    10012 1.75 . . .
    10012 1.9375 . . .
    10012 1.96875 . . .
    10012 1.71875 . . .
    10012 1.75 . . .
    10012 1.5625 . . .
    10012 1.53125 . . .
    10012 1.5625 . . .
    10012 1.6875 . . .
    10012 1.53125 . . .
    10012 1.75 . . .
    10012 1.625 . . .
    10012 1.5299999713897705 . . .
    10012 1.809999942779541 . . .
    10012 1.8899999856948853 . . .
    10012 1.7999999523162842 2000 4 15077
    10012 1.7100000381469727 . . .
    10012 1.6799999475479126 . . .
    10012 1.75 . . .
    10012 1.8700000047683716 . . .
    10012 1.9199999570846558 . . .
    10012 1.850000023841858 . . .
    10012 1.8799999952316284 . . .
    10012 1.7999999523162842 . . .
    10012 1.7799999713897705 . . .
    10012 1.7599999904632568 . . .
    10012 1.7599999904632568 . . .
    10012 1.809999942779541 . . .
    10012 1.7999999523162842 . . .
    10012 1.75 . . .
    10012 1.7599999904632568 . . .
    10012 1.7000000476837158 . . .
    10012 1.649999976158142 . . .
    10012 1.7100000381469727 . . .
    10012 1.7400000095367432 . . .
    10012 1.6799999475479126 . . .
    10012 1.7000000476837158 . . .
    10012 1.7100000381469727 . . .
    10012 1.6399999856948853 . . .
    10012 1.649999976158142 . . .
    10012 1.649999976158142 . . .
    10012 1.6100000143051147 . . .
    10012 1.600000023841858 . . .
    10012 1.600000023841858 . . .
    10012 1.600000023841858 . . .
    10012 1.6200000047683716 . . .
    10012 1.75 . . .
    10012 1.649999976158142 . . .
    10012 1.6699999570846558 . . .
    10012 1.850000023841858 . . .
    10012 2.140000104904175 . . .
    10012 2.6600000858306885 . . .
    10012 2.369999885559082 . . .
    10012 2.6500000953674316 . . .
    10012 2.700000047683716 . . .
    10012 2.5299999713897705 . . .
    10012 2.549999952316284 . . .
    10012 2.359999895095825 . . .
    10012 2.049999952316284 . . .
    10012 2.390000104904175 . . .
    10012 2.140000104904175 . . .
    10012 2.2799999713897705 . . .
    10012 2.0999999046325684 2001 1 15146
    10012 2.009999990463257 . . .
    10012 2.009999990463257 . . .
    10012 2.0399999618530273 . . .
    10012 2.009999990463257 . . .
    10012 2.5999999046325684 . . .
    10012 2.809999942779541 . . .
    10012 2.799999952316284 . . .
    10012 2.5899999141693115 . . .
    10012 2.4800000190734863 . . .
    10012 2.5999999046325684 . . .
    10012 2.4200000762939453 . . .
    10012 2.549999952316284 . . .
    10012 2.450000047683716 . . .
    10012 2.4800000190734863 . . .
    10012 2.690000057220459 . . .
    10012 2.8499999046325684 . . .
    10012 2.9700000286102295 . . .
    10012 3.2100000381469727 . . .
    10012 2.950000047683716 . . .
    10012 3.1500000953674316 . . .
    10012 3.0299999713897705 . . .
    10012 3.049999952316284 . . .
    10012 2.8299999237060547 . . .
    10012 3 . . .
    10012 2.950000047683716 . . .
    10012 3.059999942779541 . . .
    10012 3.049999952316284 . . .
    10012 2.950000047683716 . . .
    10012 3.0199999809265137 . . .
    10012 3.0999999046325684 . . .
    10012 2.9100000858306885 . . .
    10012 2.950000047683716 . . .
    10012 2.9000000953674316 . . .
    10012 2.819999933242798 . . .
    10012 2.8399999141693115 . . .
    10012 2.75 . . .
    10012 2.680000066757202 . . .
    10012 2.609999895095825 . . .
    10012 2.4600000381469727 . . .
    10012 2.309999942779541 . . .
    10012 2.390000104904175 . . .
    10012 2.25 . . .
    10012 2.319999933242798 . . .
    10012 2.200000047683716 . . .
    10012 2.2200000286102295 . . .
    10012 2.200000047683716 . . .
    10012 2.359999895095825 . . .
    10012 2.359999895095825 . . .
    10012 2.299999952316284 . . .
    10012 2.369999885559082 . . .
    10012 2.450000047683716 . . .
    10012 2.3399999141693115 . . .
    10012 2.299999952316284 . . .
    10012 2.109999895095825 . . .
    10012 2.190000057220459 . . .
    10012 2.2200000286102295 . . .
    10012 2.069999933242798 . . .
    10012 2.180000066757202 . . .
    10012 1.9600000381469727 . . .
    10012 1.850000023841858 . . .
    10012 1.7699999809265137 . . .
    10012 2 . . .
    10012 2.109999895095825 2001 2 15243
    10012 2.059999942779541 . . .
    10012 1.9600000381469727 . . .
    10012 1.899999976158142 . . .
    10012 2.0299999713897705 . . .
    10012 2.0299999713897705 . . .
    10012 2.1600000858306885 . . .
    10012 2.0999999046325684 . . .
    10012 2 . . .
    10012 2.130000114440918 . . .
    10012 2.2300000190734863 . . .
    10012 2.1600000858306885 . . .
    10012 2.25 . . .
    10012 2.1600000858306885 . . .
    10012 2.0999999046325684 . . .
    10012 2.0299999713897705 . . .
    10012 2.0899999141693115 . . .
    10012 2.015000104904175 . . .
    10012 2.0899999141693115 . . .
    10012 1.9700000286102295 . . .
    10012 2.0199999809265137 . . .
    10012 2 . . .
    10012 1.9800000190734863 . . .
    10012 2 . . .
    10012 1.9600000381469727 . . .
    10012 1.9600000381469727 . . .
    10012 2.119999885559082 . . .
    10012 2.1500000953674316 . . .
    10012 2.069999933242798 . . .
    10012 2.049999952316284 . . .
    10012 2.1700000762939453 . . .
    10012 2.130000114440918 . . .
    10012 2.2799999713897705 . . .
    10012 2.2100000381469727 . . .
    10012 2.059999942779541 . . .
    10012 2.140000104904175 . . .
    10012 2.1500000953674316 . . .
    10012 2.0999999046325684 . . .
    10012 2.0899999141693115 . . .
    10012 2.0799999237060547 . . .
    10012 2.109999895095825 . . .
    10012 2.2100000381469727 . . .
    10012 2.119999885559082 . . .
    10012 2.055000066757202 . . .
    10012 2.0299999713897705 . . .
    10012 2.0999999046325684 . . .
    10012 2.1700000762939453 . . .
    10012 2.130000114440918 . . .
    10012 2.119999885559082 . . .
    10012 2.8499999046325684 . . .
    10012 3 . . .
    10012 3.0899999141693115 . . .
    10012 3.5 . . .
    10012 3.9200000762939453 . . .
    10012 3.509999990463257 . . .
    10012 3.299999952316284 2001 3 15321
    10012 3.0899999141693115 . . .
    10012 3.299999952316284 . . .
    10012 3.3399999141693115 . . .
    10012 3.4000000953674316 . . .
    10012 3.4100000858306885 . . .
    10012 3.4800000190734863 . . .
    10012 3.2899999618530273 . . .
    10012 3.1500000953674316 . . .
    10012 3.25 . . .
    10012 3.1600000858306885 . . .
    10012 3.1500000953674316 . . .
    10012 3.119999885559082 . . .
    10016 22.5 . . .
    10016 23.5 . . .
    10016 23.3125 . . .
    10016 22.4375 . . .
    10016 22 . . .
    10016 22.375 . . .
    10016 22.1875 . . .
    10016 23.359375 . . .
    10016 22.75 . . .
    10016 23.25 . . .
    10016 22.75 . . .
    10016 23 . . .
    10016 22.75 . . .
    10016 22.0625 . . .
    10016 22.375 . . .
    10016 23 . . .
    10016 22.875 . . .
    10016 22.3125 . . .
    10016 22.296875 . . .
    10016 22.125 . . .
    10016 23.0625 . . .
    10016 21.75 . . .
    10016 23.375 . . .
    10016 22.5625 . . .
    10016 22.8125 . . .
    10016 23.125 . . .
    10016 22.875 . . .
    10016 22.8125 . . .
    10016 22.8125 . . .
    10016 22.875 . . .
    10016 22.875 . . .
    10016 22.875 . . .
    10016 22.875 . . .
    10016 22.875 . . .
    10016 22.75 . . .
    10016 22.8125 . . .
    10016 22.96875 . . .
    10016 22.75 . . .
    10016 22.75 . . .
    10016 22.75 . . .
    10016 22.75 . . .
    10016 22.75 . . .
    10016 22.8125 . . .
    10016 22.875 . . .
    10016 22.8125 . . .
    10016 22.75 . . .
    10016 23.125 . . .
    10016 22.75 . . .
    10016 22.75 . . .
    10016 22.4375 . . .
    10016 22.625 . . .
    10016 22.6875 . . .
    10016 22.921875 . . .
    10016 22.5625 . . .
    10016 22.5 . . .
    10016 22.375 . . .
    end
    format %tq fqtr
    format %td rdq

  • #2
    not sure how to measure a daily return with quarterly data.

    Comment


    • #3
      Originally posted by George Ford View Post
      not sure how to measure a daily return with quarterly data.
      I think it can be done by keeping the prices of the two days after each announcement date, then I can calculate it, but really I don’t know how to code it. Also I don’t is it right to calculate based on the following two days or the following two trading days because in my dataset there are many cases that the following two days are weekends or something like that.

      Comment


      • #4
        I don't follow what you are trying to do here. Your announcement dates are daily dates, but most observations just have missing values for that, and the non-missing ones are not closely spaced together. The only other date information in the data is the year and quarter, but these don't even correspond to the announcement dates when the latter are present. Even if they did, as these are quarterly dates, there is no way to decide which, if any, of them represent the two days following the announcement date (let alone the next two trading days). And, although I have no knowledge of finance, even if we overcame all of these problems, it is hard for me to understand why a return calculated from just two days worth of pricing would be of use for anything--especially the first two days after an announcement. Those would just represent transient shocks, unrepresentative of what the stock's normal performance would be, right?

        Comment


        • #5
          Originally posted by Clyde Schechter View Post
          I don't follow what you are trying to do here. Your announcement dates are daily dates, but most observations just have missing values for that, and the non-missing ones are not closely spaced together. The only other date information in the data is the year and quarter, but these don't even correspond to the announcement dates when the latter are present. Even if they did, as these are quarterly dates, there is no way to decide which, if any, of them represent the two days following the announcement date (let alone the next two trading days). And, although I have no knowledge of finance, even if we overcame all of these problems, it is hard for me to understand why a return calculated from just two days worth of pricing would be of use for anything--especially the first two days after an announcement. Those would just represent transient shocks, unrepresentative of what the stock's normal performance would be, right?
          thanks for your response. The data is daily and I merged between the daily prices from CRSP and announcement date from quarterly Compustat. I merged between them using the permno and date. I want to calculate the return using this interval which is defined as follows ( price two days after announcement data of the previous quarter and the price 1 day after the current announcement date). Therefore, I want to keep prices 1 and 2 days after the announcement date, then I will drop the remaining observations. Next I will using the lag of the previous price to get the price of the beginning interval. If there is any easy way to calculate to interval and the return using that interval it will be ok.

          Comment


          • #6
            You say that the data are daily, but there is no daily date variable to say what the date for any observation is. The only daily date variable in the data is rdq. At first I thought perhaps the trick is to think of the observation immediately preceding one with a non-missing rdq as the one from the day before the rdq date. But if we extrapolate that forward and backward to fill in the missing values, we get inconsistencies. For example, for PERMNO 10012, the first two rdq values are 12apr2001 and 20jun2001, which are 69 days apart. But there are only 47 observations between them, so that doesn't work.

            I may be missing something important here, but as far as I can see, what you want to do is not possible with this data because necessary date information is not there.

            Comment


            • #7
              Originally posted by Clyde Schechter View Post
              You say that the data are daily, but there is no daily date variable to say what the date for any observation is. The only daily date variable in the data is rdq. At first I thought perhaps the trick is to think of the observation immediately preceding one with a non-missing rdq as the one from the day before the rdq date. But if we extrapolate that forward and backward to fill in the missing values, we get inconsistencies. For example, for PERMNO 10012, the first two rdq values are 12apr2001 and 20jun2001, which are 69 days apart. But there are only 47 observations between them, so that doesn't work.

              I may be missing something important here, but as far as I can see, what you want to do is not possible with this data because necessary date information is not there.
              Thanks so much for your response. You are right. I added the variable of the date, which is missing in the post.
              Regards.

              Code:
              * Example generated by -dataex-. For more info, type help dataex
              clear
              input double PERMNO long date double(PRC fyearq fqtr) long rdq
              10012 14977             2.34375    . .     .
              10012 14978                2.75    . .     .
              10012 14979                2.75    . .     .
              10012 14980               2.625    . .     .
              10012 14983              2.4375    . .     .
              10012 14984              2.3125    . .     .
              10012 14985              2.3125    . .     .
              10012 14986                 2.5    . .     .
              10012 14987             2.65625    . .     .
              10012 14991               2.625    . .     .
              10012 14992              2.6875    . .     .
              10012 14993              2.6875    . .     .
              10012 14994               2.875    . .     .
              10012 14997             2.90625    . .     .
              10012 14998              3.3125    . .     .
              10012 14999               3.375    . .     .
              10012 15000               3.375    . .     .
              10012 15001              3.3125    . .     .
              10012 15004                3.25    . .     .
              10012 15005               3.125    . .     .
              10012 15006                   3    . .     .
              10012 15007              3.0625    . .     .
              10012 15008             2.90625    . .     .
              10012 15011                 2.5    . .     .
              10012 15012                 2.5    . .     .
              10012 15013             2.53125    . .     .
              10012 15014             2.53125    . .     .
              10012 15015              2.5625    . .     .
              10012 15018               2.375    . .     .
              10012 15019               2.375    . .     .
              10012 15020             2.34375    . .     .
              10012 15021             2.34375    . .     .
              10012 15022              2.4375    . .     .
              10012 15026             2.21875    . .     .
              10012 15027              2.0625    . .     .
              10012 15028              2.0625    . .     .
              10012 15029             2.03125    . .     .
              10012 15032                   2    . .     .
              10012 15033               2.125    . .     .
              10012 15034                   2    . .     .
              10012 15035             1.96875    . .     .
              10012 15036                   2    . .     .
              10012 15039                   2    . .     .
              10012 15040              2.0625    . .     .
              10012 15041               2.125    . .     .
              10012 15042             2.09375    . .     .
              10012 15043              2.0625    . .     .
              10012 15046               1.875    . .     .
              10012 15047               1.875    . .     .
              10012 15048              1.9375    . .     .
              10012 15049               1.875    . .     .
              10012 15050               1.875    . .     .
              10012 15053             1.78125    . .     .
              10012 15054              1.5625    . .     .
              10012 15055              1.5625    . .     .
              10012 15056                1.75    . .     .
              10012 15057              1.9375    . .     .
              10012 15060             1.96875    . .     .
              10012 15061             1.71875    . .     .
              10012 15062                1.75    . .     .
              10012 15063              1.5625    . .     .
              10012 15064             1.53125    . .     .
              10012 15067              1.5625    . .     .
              10012 15068              1.6875    . .     .
              10012 15069             1.53125    . .     .
              10012 15070                1.75    . .     .
              10012 15071               1.625    . .     .
              10012 15074  1.5299999713897705    . .     .
              10012 15075   1.809999942779541    . .     .
              10012 15076  1.8899999856948853    . .     .
              10012 15077  1.7999999523162842 2000 4 15077
              10012 15081  1.7100000381469727    . .     .
              10012 15082  1.6799999475479126    . .     .
              10012 15083                1.75    . .     .
              10012 15084  1.8700000047683716    . .     .
              10012 15085  1.9199999570846558    . .     .
              10012 15088   1.850000023841858    . .     .
              10012 15089  1.8799999952316284    . .     .
              10012 15090  1.7999999523162842    . .     .
              10012 15091  1.7799999713897705    . .     .
              10012 15092  1.7599999904632568    . .     .
              10012 15095  1.7599999904632568    . .     .
              10012 15096   1.809999942779541    . .     .
              10012 15097  1.7999999523162842    . .     .
              10012 15098                1.75    . .     .
              10012 15099  1.7599999904632568    . .     .
              10012 15102  1.7000000476837158    . .     .
              10012 15103   1.649999976158142    . .     .
              10012 15104  1.7100000381469727    . .     .
              10012 15105  1.7400000095367432    . .     .
              10012 15106  1.6799999475479126    . .     .
              10012 15109  1.7000000476837158    . .     .
              10012 15110  1.7100000381469727    . .     .
              10012 15111  1.6399999856948853    . .     .
              10012 15112   1.649999976158142    . .     .
              10012 15113   1.649999976158142    . .     .
              10012 15116  1.6100000143051147    . .     .
              10012 15117   1.600000023841858    . .     .
              10012 15118   1.600000023841858    . .     .
              10012 15119   1.600000023841858    . .     .
              10012 15120  1.6200000047683716    . .     .
              10012 15124                1.75    . .     .
              10012 15125   1.649999976158142    . .     .
              10012 15126  1.6699999570846558    . .     .
              10012 15127   1.850000023841858    . .     .
              10012 15130   2.140000104904175    . .     .
              10012 15131  2.6600000858306885    . .     .
              10012 15132   2.369999885559082    . .     .
              10012 15133  2.6500000953674316    . .     .
              10012 15134   2.700000047683716    . .     .
              10012 15137  2.5299999713897705    . .     .
              10012 15138   2.549999952316284    . .     .
              10012 15139   2.359999895095825    . .     .
              10012 15140   2.049999952316284    . .     .
              10012 15141   2.390000104904175    . .     .
              10012 15144   2.140000104904175    . .     .
              10012 15145  2.2799999713897705    . .     .
              10012 15146  2.0999999046325684 2001 1 15146
              10012 15147   2.009999990463257    . .     .
              10012 15148   2.009999990463257    . .     .
              10012 15151  2.0399999618530273    . .     .
              10012 15152   2.009999990463257    . .     .
              10012 15153  2.5999999046325684    . .     .
              10012 15154   2.809999942779541    . .     .
              10012 15155   2.799999952316284    . .     .
              10012 15158  2.5899999141693115    . .     .
              10012 15159  2.4800000190734863    . .     .
              10012 15161  2.5999999046325684    . .     .
              10012 15162  2.4200000762939453    . .     .
              10012 15165   2.549999952316284    . .     .
              10012 15166   2.450000047683716    . .     .
              10012 15167  2.4800000190734863    . .     .
              10012 15168   2.690000057220459    . .     .
              10012 15169  2.8499999046325684    . .     .
              10012 15172  2.9700000286102295    . .     .
              10012 15173  3.2100000381469727    . .     .
              10012 15174   2.950000047683716    . .     .
              10012 15175  3.1500000953674316    . .     .
              10012 15176  3.0299999713897705    . .     .
              10012 15179   3.049999952316284    . .     .
              10012 15180  2.8299999237060547    . .     .
              10012 15181                   3    . .     .
              10012 15182   2.950000047683716    . .     .
              10012 15183   3.059999942779541    . .     .
              10012 15186   3.049999952316284    . .     .
              10012 15187   2.950000047683716    . .     .
              10012 15188  3.0199999809265137    . .     .
              10012 15189  3.0999999046325684    . .     .
              10012 15190  2.9100000858306885    . .     .
              10012 15193   2.950000047683716    . .     .
              10012 15194  2.9000000953674316    . .     .
              10012 15195   2.819999933242798    . .     .
              10012 15196  2.8399999141693115    . .     .
              10012 15197                2.75    . .     .
              10012 15200   2.680000066757202    . .     .
              10012 15201   2.609999895095825    . .     .
              10012 15202  2.4600000381469727    . .     .
              10012 15203   2.309999942779541    . .     .
              10012 15204   2.390000104904175    . .     .
              10012 15207                2.25    . .     .
              10012 15208   2.319999933242798    . .     .
              10012 15209   2.200000047683716    . .     .
              10012 15210  2.2200000286102295    . .     .
              10012 15211   2.200000047683716    . .     .
              10012 15214   2.359999895095825    . .     .
              10012 15215   2.359999895095825    . .     .
              10012 15216   2.299999952316284    . .     .
              10012 15217   2.369999885559082    . .     .
              10012 15218   2.450000047683716    . .     .
              10012 15222  2.3399999141693115    . .     .
              10012 15223   2.299999952316284    . .     .
              10012 15224   2.109999895095825    . .     .
              10012 15225   2.190000057220459    . .     .
              10012 15228  2.2200000286102295    . .     .
              10012 15235   2.069999933242798    . .     .
              10012 15236   2.180000066757202    . .     .
              10012 15237  1.9600000381469727    . .     .
              10012 15238   1.850000023841858    . .     .
              10012 15239  1.7699999809265137    . .     .
              10012 15242                   2    . .     .
              10012 15243   2.109999895095825 2001 2 15243
              10012 15244   2.059999942779541    . .     .
              10012 15245  1.9600000381469727    . .     .
              10012 15246   1.899999976158142    . .     .
              10012 15249  2.0299999713897705    . .     .
              10012 15250  2.0299999713897705    . .     .
              10012 15251  2.1600000858306885    . .     .
              10012 15252  2.0999999046325684    . .     .
              10012 15253                   2    . .     .
              10012 15256   2.130000114440918    . .     .
              10012 15257  2.2300000190734863    . .     .
              10012 15258  2.1600000858306885    . .     .
              10012 15259                2.25    . .     .
              10012 15260  2.1600000858306885    . .     .
              10012 15263  2.0999999046325684    . .     .
              10012 15264  2.0299999713897705    . .     .
              10012 15265  2.0899999141693115    . .     .
              10012 15266   2.015000104904175    . .     .
              10012 15267  2.0899999141693115    . .     .
              10012 15270  1.9700000286102295    . .     .
              10012 15271  2.0199999809265137    . .     .
              10012 15272                   2    . .     .
              10012 15273  1.9800000190734863    . .     .
              10012 15274                   2    . .     .
              10012 15277  1.9600000381469727    . .     .
              10012 15278  1.9600000381469727    . .     .
              10012 15279   2.119999885559082    . .     .
              10012 15280  2.1500000953674316    . .     .
              10012 15281   2.069999933242798    . .     .
              10012 15284   2.049999952316284    . .     .
              10012 15285  2.1700000762939453    . .     .
              10012 15286   2.130000114440918    . .     .
              10012 15287  2.2799999713897705    . .     .
              10012 15288  2.2100000381469727    . .     .
              10012 15291   2.059999942779541    . .     .
              10012 15292   2.140000104904175    . .     .
              10012 15293  2.1500000953674316    . .     .
              10012 15294  2.0999999046325684    . .     .
              10012 15295  2.0899999141693115    . .     .
              10012 15298  2.0799999237060547    . .     .
              10012 15299   2.109999895095825    . .     .
              10012 15300  2.2100000381469727    . .     .
              10012 15302   2.119999885559082    . .     .
              10012 15305   2.055000066757202    . .     .
              10012 15306  2.0299999713897705    . .     .
              10012 15307  2.0999999046325684    . .     .
              10012 15308  2.1700000762939453    . .     .
              10012 15309   2.130000114440918    . .     .
              10012 15312   2.119999885559082    . .     .
              10012 15313  2.8499999046325684    . .     .
              10012 15314                   3    . .     .
              10012 15315  3.0899999141693115    . .     .
              10012 15316                 3.5    . .     .
              10012 15319  3.9200000762939453    . .     .
              10012 15320   3.509999990463257    . .     .
              10012 15321   3.299999952316284 2001 3 15321
              10012 15322  3.0899999141693115    . .     .
              10012 15323   3.299999952316284    . .     .
              10012 15326  3.3399999141693115    . .     .
              10012 15327  3.4000000953674316    . .     .
              10012 15328  3.4100000858306885    . .     .
              10012 15329  3.4800000190734863    . .     .
              10012 15330  3.2899999618530273    . .     .
              10012 15333  3.1500000953674316    . .     .
              10012 15335                3.25    . .     .
              10012 15336  3.1600000858306885    . .     .
              10012 15337  3.1500000953674316    . .     .
              10012 15340   3.119999885559082    . .     .
              10016 14977                22.5    . .     .
              10016 14978                23.5    . .     .
              10016 14979             23.3125    . .     .
              10016 14980             22.4375    . .     .
              10016 14983                  22    . .     .
              10016 14984              22.375    . .     .
              10016 14985             22.1875    . .     .
              10016 14986           23.359375    . .     .
              10016 14987               22.75    . .     .
              10016 14991               23.25    . .     .
              10016 14992               22.75    . .     .
              10016 14993                  23    . .     .
              10016 14994               22.75    . .     .
              10016 14997             22.0625    . .     .
              10016 14998              22.375    . .     .
              10016 14999                  23    . .     .
              10016 15000              22.875    . .     .
              10016 15001             22.3125    . .     .
              10016 15004           22.296875    . .     .
              10016 15005              22.125    . .     .
              10016 15006             23.0625    . .     .
              10016 15007               21.75    . .     .
              10016 15008              23.375    . .     .
              10016 15011             22.5625    . .     .
              10016 15012             22.8125    . .     .
              10016 15013              23.125    . .     .
              10016 15014              22.875    . .     .
              10016 15015             22.8125    . .     .
              10016 15018             22.8125    . .     .
              10016 15019              22.875    . .     .
              10016 15020              22.875    . .     .
              10016 15021              22.875    . .     .
              10016 15022              22.875    . .     .
              10016 15026              22.875    . .     .
              10016 15027               22.75    . .     .
              10016 15028             22.8125    . .     .
              10016 15029            22.96875    . .     .
              10016 15032               22.75    . .     .
              10016 15033               22.75    . .     .
              10016 15034               22.75    . .     .
              10016 15035               22.75    . .     .
              10016 15036               22.75    . .     .
              10016 15039             22.8125    . .     .
              10016 15040              22.875    . .     .
              10016 15041             22.8125    . .     .
              10016 15042               22.75    . .     .
              10016 15043              23.125    . .     .
              10016 15046               22.75    . .     .
              10016 15047               22.75    . .     .
              10016 15048             22.4375    . .     .
              10016 15049              22.625    . .     .
              10016 15050             22.6875    . .     .
              10016 15053           22.921875    . .     .
              10016 15054             22.5625    . .     .
              10016 15055                22.5    . .     .
              10016 15056              22.375    . .     .
              10016 15057             22.5625    . .     .
              10016 15060                22.5    . .     .
              10016 15061             22.4375    . .     .
              10016 15062             22.3125    . .     .
              10016 15063               22.25    . .     .
              10016 15064              22.125    . .     .
              10016 15067             22.1875    . .     .
              10016 15068               22.25    . .     .
              10016 15069               22.25    . .     .
              10016 15070                22.5    . .     .
              10016 15071               22.25    . .     .
              10016 15074    22.1299991607666    . .     .
              10016 15075  22.450000762939453    . .     .
              10016 15076  22.420000076293945    . .     .
              10016 15077  22.489999771118164    . .     .
              10016 15081  22.350000381469727    . .     .
              10016 15082  22.479999542236328    . .     .
              10016 15083  22.959999084472656    . .     .
              10016 15084  22.799999237060547    . .     .
              10016 15085  22.760000228881836    . .     .
              10016 15088  22.760000228881836    . .     .
              10016 15089   22.81999969482422 2001 1 15089
              10016 15090  23.020000457763672    . .     .
              10016 15091                23.5    . .     .
              10016 15092  23.600000381469727    . .     .
              10016 15095                23.5    . .     .
              10016 15096  23.299999237060547    . .     .
              10016 15097  22.579999923706055    . .     .
              10016 15098  22.719999313354492    . .     .
              10032 14977             27.6875    . .     .
              10032 14978             34.5625    . .     .
              10032 14979             29.9375    . .     .
              10032 14980               29.25    . .     .
              10032 14983                  28    . .     .
              10032 14984                27.5    . .     .
              10032 14985             30.3125    . .     .
              10032 14986                36.5    . .     .
              10032 14987             38.1875    . .     .
              10032 14991             31.6875    . .     .
              10032 14992             31.4375    . .     .
              10032 14993              34.375 2001 1 14993
              10032 14994             43.6875    . .     .
              10032 14997               43.75    . .     .
              10032 14998             42.6875    . .     .
              10032 14999              40.625    . .     .
              10032 15000                38.5    . .     .
              10032 15001             40.6875    . .     .
              10032 15004             45.9375    . .     .
              10032 15005           45.390625    . .     .
              10032 15006             46.9375    . .     .
              10032 15007               49.25    . .     .
              10032 15008              46.375    . .     .
              10032 15011              45.875    . .     .
              10032 15012                  44    . .     .
              10032 15013              42.125    . .     .
              10032 15014                  44    . .     .
              10032 15015                41.5    . .     .
              10032 15018           38.359375    . .     .
              10032 15019             39.5625    . .     .
              10032 15020              40.875    . .     .
              10032 15021              44.625    . .     .
              10032 15022                  40    . .     .
              10032 15026              38.375    . .     .
              10032 15027              36.125    . .     .
              10032 15028                  34    . .     .
              10032 15029              35.375    . .     .
              10032 15032              37.625    . .     .
              10032 15033             32.6875    . .     .
              10032 15034              30.875    . .     .
              10032 15035              31.875    . .     .
              10032 15036             35.3125    . .     .
              10032 15039              33.875    . .     .
              10032 15040                37.5    . .     .
              10032 15041           38.140625    . .     .
              10032 15042             35.0625    . .     .
              10032 15043               33.75    . .     .
              10032 15046               30.25    . .     .
              10032 15047             30.3125    . .     .
              10032 15048             29.6875    . .     .
              10032 15049                  29    . .     .
              10032 15050              26.375    . .     .
              10032 15053             29.5625    . .     .
              10032 15054              26.375    . .     .
              10032 15055             25.1875    . .     .
              10032 15056                  28    . .     .
              10032 15057                  30    . .     .
              10032 15060             29.4375    . .     .
              10032 15061             31.0625    . .     .
              10032 15062                  27    . .     .
              10032 15063             25.0625    . .     .
              10032 15064              25.625    . .     .
              10032 15067               24.25    . .     .
              10032 15068               21.25    . .     .
              10032 15069              20.625    . .     .
              10032 15070             25.6875    . .     .
              10032 15071                  23    . .     .
              10032 15074  23.899999618530273    . .     .
              10032 15075  26.260000228881836    . .     .
              10032 15076  27.709999084472656    . .     .
              10032 15077  30.399999618530273    . .     .
              10032 15081  25.950000762939453    . .     .
              10032 15082  26.899999618530273    . .     .
              10032 15083  31.399999618530273    . .     .
              10032 15084    34.2400016784668 2001 2 15084
              10032 15085   32.54999923706055    . .     .
              10032 15088    30.1200008392334    . .     .
              10032 15089  30.549999237060547    . .     .
              10032 15090   31.09000015258789    . .     .
              10032 15091  30.469999313354492    . .     .
              10032 15092                  31    . .     .
              10032 15095  30.719999313354492    . .     .
              10032 15096  31.420000076293945    . .     .
              10032 15097  35.709999084472656    . .     .
              10032 15098   35.20000076293945    . .     .
              10032 15099   36.29999923706055    . .     .
              10032 15102   36.02000045776367    . .     .
              10032 15103                35.5    . .     .
              10032 15104   34.90999984741211    . .     .
              10032 15105    32.9900016784668    . .     .
              10032 15106   32.36000061035156    . .     .
              10032 15109  31.649999618530273    . .     .
              10032 15110    31.6200008392334    . .     .
              10032 15111    33.2599983215332    . .     .
              10032 15112   34.09000015258789    . .     .
              10032 15113   33.95000076293945    . .     .
              10032 15116  38.540000915527344    . .     .
              10032 15117   38.63999938964844    . .     .
              10032 15118  34.630001068115234    . .     .
              10032 15119   35.33000183105469    . .     .
              10032 15120    33.9900016784668    . .     .
              10032 15124  31.780000686645508    . .     .
              10032 15125  28.860000610351563    . .     .
              10032 15126  30.190000534057617    . .     .
              10032 15127                  32    . .     .
              10032 15130               31.25    . .     .
              10032 15131   32.70000076293945    . .     .
              10032 15132   32.52000045776367    . .     .
              10032 15133   32.86000061035156    . .     .
              10032 15134  31.899999618530273    . .     .
              10032 15137  30.450000762939453    . .     .
              10032 15138                  29    . .     .
              10032 15139  28.309999465942383    . .     .
              10032 15140  26.579999923706055    . .     .
              10032 15141  25.799999237060547    . .     .
              10032 15144  24.280000686645508    . .     .
              10032 15145  24.479999542236328    . .     .
              10032 15146  24.639999389648438    . .     .
              10032 15147  25.639999389648438    . .     .
              10032 15148  24.610000610351563    . .     .
              10032 15151  25.530000686645508    . .     .
              10032 15152   26.57900047302246    . .     .
              10032 15153   27.15999984741211    . .     .
              10032 15154  29.469999313354492    . .     .
              10032 15155                  33    . .     .
              10032 15158  30.139999389648438    . .     .
              10032 15159  29.889999389648438    . .     .
              10032 15161  29.200000762939453    . .     .
              10032 15162  27.899999618530273    . .     .
              10032 15165  28.459999084472656    . .     .
              10032 15166  27.049999237060547    . .     .
              10032 15167               26.25    . .     .
              10032 15168                  30    . .     .
              10032 15169  29.600000381469727    . .     .
              10032 15172  29.920000076293945    . .     .
              10032 15173  30.049999237060547    . .     .
              10032 15174  27.670000076293945    . .     .
              10032 15175   32.04999923706055 2001 3 15175
              10032 15176  32.630001068115234    . .     .
              10032 15179  31.440000534057617    . .     .
              10032 15180   32.54999923706055    . .     .
              10032 15181                  34    . .     .
              10032 15182  35.400001525878906    . .     .
              10032 15183    35.7400016784668    . .     .
              10032 15186   35.43000030517578    . .     .
              10032 15187  35.810001373291016    . .     .
              10032 15188   38.45000076293945    . .     .
              10032 15189                40.5    . .     .
              10032 15190   38.04999923706055    . .     .
              10032 15193   37.45000076293945    . .     .
              10032 15194  36.650001525878906    . .     .
              10032 15195  34.689998626708984    . .     .
              10032 15196   34.40999984741211    . .     .
              10032 15197   34.33000183105469    . .     .
              10032 15200   35.70000076293945    . .     .
              10032 15201  35.099998474121094    . .     .
              10032 15202   32.83000183105469    . .     .
              10032 15203   33.40999984741211    . .     .
              10032 15204  32.060001373291016    . .     .
              10032 15207   33.31999969482422    . .     .
              10032 15208  32.349998474121094    . .     .
              10032 15209   33.88999938964844    . .     .
              10032 15210   32.81999969482422    . .     .
              10032 15211  36.189998626708984    . .     .
              10032 15214   36.04999923706055    . .     .
              10032 15215  34.939998626708984    . .     .
              10032 15216   35.70000076293945    . .     .
              10032 15217   33.65999984741211    . .     .
              10032 15218   34.81999969482422    . .     .
              10032 15222  33.150001525878906    . .     .
              10032 15223   32.91999816894531    . .     .
              10032 15224  31.600000381469727    . .     .
              10032 15225  31.420000076293945    . .     .
              10032 15228    30.1200008392334    . .     .
              10032 15235  27.979999542236328    . .     .
              10032 15236               27.25    . .     .
              10032 15237  27.489999771118164    . .     .
              10032 15238  26.270000457763672    . .     .
              10032 15239  24.489999771118164    . .     .
              end
              format %td date
              format %tq fqtr
              format %td rdq

              Comment


              • #8
                Thank you.

                I think this will get you what you asked for:
                Code:
                tempfile copy
                save `copy'
                
                keep if !missing(rdq)
                
                rangejoin date 1 2 using `copy', by(PERMNO) keepusing(date PRC)
                gen delta = date_U - date
                drop if missing(delta)
                reshape wide date_U PRC_U, i(PERMNO rdq) j(delta)
                
                by PERMNO (rdq): gen period_price_ratio = PRC_U1[_n+1]/PRC_U2
                gen period_return_pct = 100*(period_price_ratio-1)
                gen annualized_price_ratio = period_price_ratio^(365/(date_U1[_n+1]-date_U2))
                gen annualized_return_pct = 100*(annualized_price_ratio-1)
                -rangejoin- is written by Robert Picard and is available from SSC. To use it, you must also install -rangestat-, by Robert Picard, Nick Cox, and Roberto Ferrer, also available from SSC.

                Comment

                Working...
                X