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 ↗
← SASnRConvert Dates to Formatted Character Strings

Introduction

  • Clinical reports and TFL outputs need dates displayed in specific character formats β€” "15JAN2025" for listings, "2025-01-15" for ISO compliance, custom layouts for headers.
  • This is the reverse of parsing: we start with a proper date value and produce a character string in the desired format.
  • SAS uses the PUT function with a date format; R uses format() with strftime tokens.
  • A common clinical need is the uppercase month abbreviation ("15JAN2025" not "15jan2025"), which requires an extra step in R.
  • This lesson converts the same set of dates into several output formats and shows how to get the uppercase month name that clinical displays expect.

Convert Dates to Formatted Character Strings