Previous PageNext Page

Match merges
Safely create a single data set from the information in the two data sets. Use a BY statement in the data step to specify the index variable(s) that should be used to match up the observations.

Title 'Like Example 4 in C&P Chapter 3';
Proc Sort data=GenYear;
     BY Subj;
Proc Sort data=HtWt;
     BY Subj;
Data Survey12;
     Merge GenYear HtWt;
     BY Subj;
Proc Print;
     ID Subj;

The final output is fine.

Like Example 4 in C&P Chapter 3

SUBJ    GENDER    YEAR    HEIGHT    WEIGHT

  1       M        91        68       155
  5       F        92       102        63
  7       F        90        72       205
  8       M        91       250        70
  9       M        93        66       120

Previous PageTable Of ContentsNext Page