Announcement

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

  • Condition with Date

    Good afternoon,

    I've tried a few solutions for this and I can't find one.
    Looking to put a 1 in the wanted variable - if greater or equal to a given specific date in ddate (%td format)

    Thank you.

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input float(ddate wanted)
    23062 0
    23062 0
    23062 0
    23062 0
    23062 0
    23062 0
    23062 0
    23062 0
    23062 0
    23062 0
    23062 0
    23062 0
    23063 1
    23063 1
    23063 1
    end
    format %td ddate

  • #2
    you did not say which date you wanted but the following matches what you have and changing it should be easy:
    Code:
    gen byte wanted2=ddate>=td(22feb2023)

    Comment


    • #3
      Thanks, Rich. Works fine.

      Comment

      Working...
      X