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 ↗
← SASnRCreate Sample Data

Introduction

  • Before we can run any analysis, we need data in memory. In a teaching setting, the quickest way is to build a tiny dataset inline inside the program itself — no external files, no study database.
  • SAS programmers typically do this with a DATA step plus datalines. R offers two natural alternatives: tribble() for a readable row-wise form and data.frame() for a column-wise form.
  • This lesson shows the same 3-row CLASS dataset built in each environment so we can compare the syntax side by side.
  • After running any of the three, we should have a table with columns Name, Sex, Age, Height and Weight, and three observations representing Alfred, Alice and Barbara.

Create Sample Data