SAS INTNX for Missing date

Background Story:

Missing dates are something the pharmaceutical industry deals with on a daily basis. There are some common methods.

  1. Completely missing year, month, and day then no imputation.
  2. Set a certain number( ex.Jan01) for missing month and day
  3. Compare with treatment start date, and manipulate accordingly.
    If the AE start date and the treatment start date have the same year and month then we set the missing AE start date the same as the treatment start date.
    if the AE start date and the treatment start date have the same year, the AE start month is later than the treatment start month. we set the AE start date to be the first day of the month(xx-01).
    if the AE start date is earlier than the treatment starting month. We set AE start day to be the last day of the month(xx-31/30/29/28)

As we can see, the 3rd method is the best model, however, it is a little complicated to implement it. Because we have to consider different year and month when it comes to the last day of the month.

Luckily we have INTNX function.

Goal: Imputate Partial Missing AE date.

Key SAS Function: INTNX, Year, Month, Input

Sample Code:

Sample Output:

Happy Studying!