Announcement

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

  • Formatting string into a date format

    I have a string variable containing dates "17-Jan-24" in this format. How to get this variable into a date format? Any help regarding this would be highly appreciated.

  • #2
    The issue is variable or storage type, not (display) format.

    Code:
    gen wanted = daily(date, "DMY", 2025) 
    format wanted %td
    should get you moving. Do have a look at

    Code:
    help daily()
    which explains what you need to know. daily() is the same function as date(). I emphasise its use because it's all too easy to imagine that date() also produces dates other than daily dates, but it doesn't.

    Comment

    Working...
    X