Announcement

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

  • How do i generate a monthly variance from a daily dataset

    Hi, I have an exchange rate dataset that has a daily frequency and i would like to generate the monthly variance. May I know how you can go about doing it. Do I run an "foreach" loop command involved?

  • #2
    Define a monthly date variable and call up egen. You can just square the SD result.

    Code:
     
    gen mdate = mofd(ddate) 
    help egen
    egen var = sd(whatever), by(mdate)
    replace var = var^2
    If you want a rolling variance, check out tsegen from SSC.

    Comment

    Working...
    X