Announcement

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

  • replacing a missing date time var

    Hi all,

    I have dates in my data like below. They show up like 12nov2022 00:00:00. I want to do something where I replace it to put "04nov2022 00:00:00" if whatever time if the date is missing. But I can't figure out how to do this. Can you assist? Thanks!


    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input double reldate
    1964248199999.9998

  • #2
    Code:
    . di %tc clock("4 Nov 2022", "DMY")
    04nov2022 00:00:00
    so the scalar you want is obtainable as clock("4 Nov 2022", "DMY")

    but make sure that the variable you are replacing is double.

    Comment


    • #3
      So would I do something like replace var=clock("4 Nov 2022", "DMY") if var==. ?

      Comment


      • #4
        Correct.

        Comment

        Working...
        X