In the following example, you have basic patient data
in Cert.Patients that you want to combine with other patient data
that is stored in Cert.Measure. The height and weight data is stored
in the data set Cert.Measure. Both data sets are sorted by the variable
ID.
Notice that Cert.Patients
contains nine out of eleven observations in which the patient age
is less than 60.
To subset observations
from the first data set and combine them with observations from the
second data set, you can submit the following program:
data work.one2one;
set cert.patients;
if age<60;
set cert.measure;
run;
The resulting data set,
Work.One2one, contains six observations (the number of observations
read from the smallest data set, which is Cert.Measure). The last
observation in Cert.Patients is not written to the data set because
the second SET statement reaches an end-of-file, which stops the DATA
step processing.