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 ↗
← SASnRAdd an Interval to a Date

Introduction

  • Clinical protocols often define time points relative to a starting date β€” visit windows, cutoff dates, follow-up milestones.
  • Adding days is straightforward arithmetic, but adding months or years requires calendar awareness because months vary in length.
  • SAS uses the INTNX function with an alignment option that controls where the result lands within the target interval.
  • R tidyverse uses lubridate arithmetic: days(), months(), and the rollback-safe %m+% operator.
  • This lesson adds day, month, and year offsets to protocol-defined dates and compares how each language handles end-of-month edge cases.

Add an Interval to a Date