Previous PageNext Page

What if the variables are in a different order?
Let's reverse the order of the variables in SURVEY2.

DATA SURVEY2;
   INPUT YEAR WEIGHT HEIGHT GENDER :$1. SUBJ;
DATALINES;
92 102 63 F 5
91 250 70 M 8
Proc Print Data=Library.Survey1; ID Subj; Title 'Survey1';
Proc Print Data=        Survey2; ID Subj; Title 'Survey2';
DATA Library.SURVEY12;
   Set Library.Survey1 Survey2;
Proc Print; ID SUBJ; Title 'Both';

The output:

Survey1
SUBJ    GENDER    HEIGHT    WEIGHT    YEAR

  1       M         68        155      91
  7       F         72        205      90
  9       M         66        120      93

Survey2
SUBJ    YEAR    WEIGHT    HEIGHT    GENDER

  5      92       102       63        F
  8      91       250       70        M

Both 
SUBJ    GENDER    HEIGHT    WEIGHT    YEAR

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

Remember the rule: the characteristics of variables are defined the first time the compiler sees them.

Previous PageTable Of ContentsNext Page