Example 2.2 Interleaving Observations from Two or More Data Sets Based on a Common Variable

Goal

Interleave the observations from three data sets in order by the values of a specific variable. Define a variable that identifies the data set from which the observation originated.

Example Features

Featured StepDATA step
Featured Step Options and StatementsSET statement, IN= option BY statement
Related TechniquePROC SQL, OUTER UNION set operator and CORR keyword, ORDER BY clause

Input Data Sets

Data sets SPRINGGRADS, SUMMERGRADS, and FALLGRADS contain lists of biology students who graduated in spring, summer, and fall. The students' final GPAs are included.

Example 2.1 also uses the three data sets.

                SPRINGGRADS

Obs      student       concentration      gpa 1 ...

Get Combining and Modifying SAS® Data Sets: Examples Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.