Identifiers can be used to copy information from one level of the file to another. The following SAS code (or equivalent) can be used to copy information from one level to another:
PROC SORT DATA=GSS14EP; *Person level file;
BY ABSHID;
RUN;
PROC SORT DATA=GSS14EH; *Household level file;
BY ABSHID;
RUN;
DATA MERGE_FILE;
MERGE GSS14EP (IN=A) GSS14EH (IN=B);
BY ABSHID;
IF A AND B THEN OUTPUT;
RUN;
The following SAS code (or equivalent) can be used to copy information from a higher level to a level below:
PROC SORT DATA=GSS14EP; *Person level file;
BY ABSHID;
RUN;
PROC SORT DATA=GSS14EV; *Volunteering level file;
BY ABSHID;
RUN;
DATA MERGE_FILE;
MERGE GSS14EV (IN=A) GSS14EP (IN=B)
BY ABSHID;
IF A AND B THEN OUTPUT; *Only keeps records which are present on both files;
RUN;
This merge will match one GSS14EP record to many GSS14EV records. The statement 'If A and B then OUTPUT;' ensures that only records present on both files are kept. If this statement was not used then GSS14EP records without a corresponding GSS14EV record would appear with a missing value for all GSS14EV data items. Note that the data items copied from the GSS14EP level will now have the counting unit for the level they have been added to, being instances of volunteering in this case.
Combining data from different levels can sometimes be confusing, both in selecting an appropriate item and in understanding the counting unit. For example, if you are interested in volunteering activity, and you want to analyse this by volunteers' characteristics such as sex or age, then you might cross-tabulate SEX by VOLSECT (organisation sector type). This would yield results indicating the estimate (or sample count) of instances of volunteering in each sector, split by sex, rather than the estimate (or sample count) of males or females and their respective activity as volunteers in each sector. When looking at the volunteering level, the counting unit is instances of volunteering, rather than persons.