A little announcement. A lot to explore.

Happy learning!

Explore lessons, including SAS & R programs and practice data.

Search lessons

Type at least 3 characters to see matching lessons.

Open SAS ↗Open R ↗
← SASnRCalculate the Difference Between Two Dates

Introduction

  • Clinical programming constantly needs the gap between two dates β€” study day derivation (ASTDY), treatment duration, time between adverse events.
  • The simplest case is a day count, but month and year intervals matter too β€” for example, cycles of chemotherapy or annual lab windows.
  • SAS uses the INTCK function with an interval keyword; R works with difftime or lubridate arithmetic.
  • Study day (ASTDY) is one of the most common derivations in ADaM: it counts the days from the reference start date to an event date, skipping day zero.
  • This lesson derives study day and treatment duration from a small adverse-event dataset with reference start dates.

Calculate the Difference Between Two Dates