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 ↗
← SASnRFirst dot and last dot concept

Introduction

  • Sometimes we want rows where a group has exactly one record — subjects with a single visit, ages that appear only once, terms reported by only one subject.
  • In SAS, first.var AND last.var on the same row is the flag combination that marks a group of size one — the row is both the first and the last in its group.
  • Tidyverse counts group size with mutate(nrows = n()) after group_by(), then filters to nrows == 1.
  • Base R uses ave(..., FUN = length) to compute the group size per row, then subsets to rows where the size is 1.
  • This lesson picks ages that appear in exactly one row of CLASS — the ones where the Age group has only a single subject.
  • After running, inspect the result and confirm each surviving Age value shows up only once in CLASS.

First dot and last dot concept