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 ↗
← SASnRCharacter Functions

Introduction

  • Character functions cover the everyday chores of clinical string handling: measure a value, count a separator, extract a piece, replace a token, check for missing.
  • Most SAS character functions have a direct analogue in R, usually in the stringr package plus a few base R helpers.
  • SAS offers length, countw, scan, countc, find, substr, catx, translate, tranwrd, and missing as the daily toolkit.
  • Tidyverse mirrors these with str_length, str_count, word, str_locate, str_sub, str_c, chartr, str_replace_all, and is.na.
  • Base R covers them with nchar, strsplit, gregexpr, regexpr, substr, paste, chartr, gsub, and is.na.
  • This lesson applies each function to a column of ISO-8601 partial dates so we can compare the outputs side by side across the three languages.

Character Functions