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 ↗
← SASnRDescriptive statistics for numeric variables

Introduction

  • Descriptive statistics — n, mean, standard deviation, min, max — are the everyday summary of any numeric variable.
  • Typical requests: height summary across all subjects, then the same summary broken down by sex or by treatment arm.
  • SAS offers proc summary (or the closely related proc means) to compute these on the full dataset or within class levels.
  • Tidyverse uses summarize() with group_by() for the grouped form — a compact, pipe-friendly pattern.
  • Base R uses aggregate() with a small custom function to return several statistics at once, plus an unpacking step.
  • This lesson computes n, mean, and sd for Height on CLASS, first overall and then split by Sex.

Descriptive statistics for numeric variables