Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
The Data Table

Combining Tables

You can concatenate the rows or merge the columns from two or more tables.

Concatenating Tables by Rows

To vertically join tables by concatenating their rows, select Data arrow Combine Tables arrow Concatenate By Rows ...

c0225.gif (7891 bytes)

Figure 2.25: Concatenate Tables by Rows Dialog

Click on the Open SAS Data button to open SAS data tables. Click on the Browse button to select a file from your operating system's directory.

To change the order of the tables that you are appending, select a table and click on the up or down arrow to move the table one level up or one level down in the list.

To remove a table from the list, select the table and click on the Remove button.

Select Append to append the tables that you have selected. If you have chosen to append the tables, you can change the order of tables in the list. When you append tables, the rows of the first table are followed by the rows of the succeeding tables.

Select Interleave to interleave the rows of the tables.

Common variables among the tables you have chosen to concatenate are listed in the Common variables list. Select a common variable and click on the Interleave By button to add it to the list of variables to interleave by. When you interleave table rows, the rows of the table are combined and ordered according to the common variables that you have selected.

Select a variable and click on the Remove button to remove it from the list of Interleave By variables.

Click on the Variables button to choose the variables that you want to keep in your concatenation. By default, when you concatenate by rows, the resulting table contains only the common variables.

Merging Tables by Columns

To join tables horizontally by merging their columns, select Data arrow Combine Tables arrow Merge By Columns ...

c0226.gif (7905 bytes)

Figure 2.26: Merge Tables by Columns Dialog

In the Merge Tables by Columns dialog, you can select data tables to merge and the variables you will keep in the merged table. You can merge up to six tables. Type the name of the table in the Table name field, click on the arrow to select a SAS data table, or click on the Browse button to select a file from a directory.

Click on the More button to merge more than two tables.

You can choose whether the new combined table displays only matching rows, rows that match those in Table 1, or all rows.

Common variables among the tables you have chosen to combine are listed in the Common variables list.

Select a common variable and click on the Merge By button to add it to the list of variables to combine the tables by.

Select a variable and click on the Remove button to remove it from the list of Merge By variables.

Click on the Variables button to choose the variables that you want to keep in your merged table. By default, when you merge by columns, the resulting table contains all the variables.

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.