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 ↗
← SASnRRenaming variables

Introduction

  • Renaming variables is a routine step — we might rename to meet an analysis spec, to match a standard like SDTM, or simply to make the column self-documenting.
  • SAS does this inside a DATA step with the rename statement (or as a dataset option).
  • In tidyverse we use rename() from dplyr. In base R we assign to names() directly.
  • This lesson renames the Age column of CLASS to age_in_years so we can compare the three approaches side by side.
  • After running, we should have a new dataset identical to CLASS except the Age column is now called age_in_years.

Renaming variables