Announcement

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

  • How to create dummy variables for each month?

    Hi again -- I have a date variable in the form of the example below. It runs from January 1,2017 to December 31, 2017. I wish to create 12 dummy variables, one for each month January-December. Any suggestions? Thanks!

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float stata_date
    21034
    21134
    20994
    20995
    20918
    end
    format %td stata_date

  • #2
    Apologies. I was overthinking this. Simple code.

    Code:
    gen month=month(stata_date)

    Comment

    Working...
    X