Announcement

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

  • Making Day by Year Time Series

    Hello all,

    I am currently working on an assignment for a class and I see that the code D only applies for the month. I have not found a way to make this work for the year. So that it goes for 1-365(6) instead of the regular 1-31. Any help would be appreciated on this topic. Thank you.

  • #2
    I find this hard to follow, but consider today's date as a daily date:

    Code:
    . di mdy(2, 18, 2022)
    22694
    
    . di %td mdy(2, 18, 2022)
    18feb2022
    
    . 
    . di day(22694)
    18
    
    . di doy(22694)
    49
    
    . di 31 + 18
    49
    In short, day() retrieves the day of the month from a daily date and doy() retrieves the day of the year. In your case it's more likely that you are dealing with date variables, but either function works with generate.

    If this is not what you seek, I think you will need to add details of your data, code tried, and what happened (e.g. error messages). Please do look through the FAQ Advice, as you are prompted to do.

    https://www.statalist.org/forums/help#adviceextras #4 explains our advice on assignments. As you asked a specific question, and didn't just copy chunks of your assignment at us, I am happy to try to help in this case.



    Comment


    • #3
      Thank you! I will look over the FAQ's and the advice given here, will keep in mind for future asks!

      Comment

      Working...
      X