Announcement

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

  • Help with converting date variable

    Hello all,

    Here is the code that I am working with:

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input str10 announced_date
    "04/10/2012"
    "05/12/2013"
    "22/03/2013"
    "04/01/2009"
    "26/10/2012"
    "22/10/2000"
    "05/04/2007"
    "29/10/2013"
    "19/09/2013"
    "30/12/2013"
    end
    I would like to convert this date variable into a numeric variable with the form ddmmyyyy; so for example: 02jan1997, 03jan1997, 04jan1997 etc.

    Can anyone help me out with this?

    Thanks

  • #2
    Dear William, Please try
    Code:
    gen t = date(announced_date,"DMY")
    format t %td
    Ho-Chuan (River) Huang
    Stata 19.0, MP(4)

    Comment


    • #3
      Thank you River, your code works

      Comment

      Working...
      X