Example 2.1 Concatenating Data Sets 14
Example 2.2 Interleaving Observations from Two or More Data Sets Based on a Common Variable 17
Example 2.3 Appending One Data Set to the End of Another Data Set 20
Example 2.4 Selecting Unique Rows When Concatenating Tables 23
Example 2.5 Selecting Rows in Common When Concatenating Tables 26
Example 2.6 Selecting Observations Unique to Each Data Set When Concatenating Data Sets 28
When you combine data sets vertically, you concatenate the data sets one after another, or you interleave observations from the data sets in order by one or more variables. Observations are not combined side-by-side horizontally or overlaid.
Data sets can be combined vertically by using the DATA step, PROC SQL, PROC APPEND, or the APPEND statement in the DATASETS procedure.
When using the DATA step or PROC SQL, you can specify conditions under which to combine the data sets. For example, PROC SQL has set operators, UNION, EXCEPT, INTERSECT, and OUTER UNION, that control how to combine the results of queries. These operators find unique rows and rows in common between queries. In the DATA step, you can use the values of BY variables to interleave observations in a specific order when reading multiple input data sets. The ORDER BY clause works similarly in PROC SQL.
PROC APPEND and PROC DATASETS do not have programming features to control how your data sets are combined vertically. However, the advantage of these procedures is realized when you need to conserve computing resources because these procedures do not recopy the base data set to which you are concatenating another data set.
52.14.136.168