Announcement

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

  • Quarter Averages to Yearly Averages

    Hello,

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float(fundnr month year q_mf_expratio)
    1  7 2011  1.305195
    1  8 2011  1.305195
    1  9 2011  1.305195
    1 10 2011 1.3438524
    1 11 2011 1.3438524
    1 12 2011 1.3438524
    1  1 2012 1.3517568
    1  2 2012 1.3517568
    1  3 2012 1.3517568
    1  4 2012 1.3203474
    1  5 2012 1.3203474
    1  6 2012 1.3203474
    1  7 2012  1.329235
    1  8 2012  1.329235
    1  9 2012  1.329235
    1 10 2012 1.3242614
    1 11 2012 1.3242614
    1 12 2012 1.3242614
    1  1 2013 1.1346366
    1  2 2013 1.1346366
    1  3 2013 1.1346366
    1  4 2013 1.1041577
    1  5 2013 1.1041577
    1  6 2013 1.1041577
    1  7 2013 1.1157745
    1  8 2013 1.1157745
    1  9 2013 1.1157745
    1 10 2013 1.1379126
    1 11 2013 1.1379126
    1 12 2013 1.1379126
    1  1 2014 1.0696377
    1  2 2014 1.0696377
    1  3 2014 1.0696377
    1  4 2014 1.0903803
    1  5 2014 1.0903803
    1  6 2014 1.0903803
    1  7 2014 1.0906675
    1  8 2014 1.0906675
    1  9 2014 1.0906675
    1 10 2014  1.098166
    1 11 2014  1.098166
    1 12 2014  1.098166
    1  1 2015 1.0920255
    1  2 2015 1.0920255
    1  3 2015 1.0920255
    1  4 2015  1.193412
    2  8 2011  .7761759
    2  9 2011  .7761759
    2 10 2011  .8770025
    2 11 2011  .8770025
    2 12 2011  .8770025
    2  1 2012  .8935469
    2  2 2012  .8935469
    2  3 2012  .8935469
    2  4 2012  .8624817
    2  5 2012  .8624817
    2  6 2012  .8624817
    2  7 2012  .8760487
    2  8 2012  .8760487
    2  9 2012  .8760487
    2 10 2012  .9519633
    2 11 2012  .9519633
    2 12 2012  .9519633
    2  1 2013 1.0320818
    2  2 2013 1.0320818
    2  3 2013 1.0320818
    2  4 2013 1.0079682
    2  5 2013 1.0079682
    2  6 2013 1.0079682
    2  7 2013 1.0340407
    2  8 2013 1.0340407
    2  9 2013 1.0340407
    2 10 2013  .9332104
    2 11 2013  .9332104
    2 12 2013  .9332104
    2  1 2014  .8537141
    2  2 2014  .8537141
    2  3 2014  .8537141
    2  4 2014  .8638967
    2  5 2014  .8638967
    2  6 2014  .8638967
    2  7 2014  .8533909
    2  8 2014  .8533909
    2  9 2014  .8533909
    2 10 2014  .8720222
    2 11 2014  .8720222
    2 12 2014  .8720222
    2  1 2015  .8694636
    2  2 2015  .8694636
    2  3 2015  .8694636
    2  4 2015  .8601169
    2  5 2015  .8601169
    2  6 2015  .8601169
    2  7 2015  .8387364
    2  8 2015  .8387364
    2  9 2015  .8387364
    2 10 2015  .8791451
    2 11 2015  .8791451
    2 12 2015  .8791451
    2  1 2016  .8448672
    end

    q_mf_expratio stands for 'Quarter Average of Win. monthly expense ratio on fundlevel', I am trying to get the average expense ratio in the average year. Is it possible to go from quarter averages to yearly averages for each fundnr in each year?

  • #2
    Just collapse on your ids by year.
    Code:
    collapse (mean) vars, by(id year)

    Comment

    Working...
    X