Merge Multiple Files

This dialog can be used to merge data from multiple files from different file formats into a single spreadsheet. Data rows are matched between the files using identifying columns that are present in each of the files. On merging the files any additional columns that are not used to identify a match are added to the end of the newly created spreadsheet in turn using the row order of the initial file. If any of these columns share the same name between files, the subsequent column names will be changed to make a unique name.

Filename

The name of a file that is to be merged. You can type in the name of a file including its full path directly. Alternatively, you can browse for a file by clicking the button. Files that are selected using the browse dialog will be added to the list of filenames automatically. However, if you type in the filename directly the Add button should be used to add the filename to the list of files to be merged. Multiple files can be selected using the browse dialog by selecting one or more files using the Ctrl or Shift keys. For multi-paged GenStat books (GWB) or Excel files, you will be prompted for each of these files in turn to select one or more of the sheets within the file to merge. Note that if a GenStat book only contains one sheet no prompt will appear.

The files are merged in the order that they are displayed in the list, however, you can change the order of the files in the list using the Up, Down and Bottom buttons.

Add

Add the filename in the Filename field into the list of files.

Change

Replace the selected the filename in the list with the name in the Filename field.

Remove

Remove the selected filename(s) from the list.

Up

Move the selected filename up once place in the list.

Down

Move the selected filename down once place in the list.

Bottom

Move the selected filename to the last place in the list.

Identifying Columns for Merge

This list specifies the names of the columns to use to identify the matching rows between the files. Each identifying column must appear in all the files that are being merged. The names of the columns should be entered directly and each column name must appear on a separate row in the list. A maximum of 8 column names can be supplied.

Check for Factors

When selected, GenStat checks all columns to see if they contain repeated values. If columns appear to contain categorical data you are prompted to convert these to factors.

Check for Dates

When selected, GenStat checks all text columns to see if they contain data in date format. If columns appear to contain data in date format you are prompted to convert these to dates.

Set as Active Sheet

This sets the new spreadsheet that is created as the Active spreadsheet.

Add to Book

This lists all open books within GenStat. Select the book that the new sheet will be added to. If the data are to appear in a new book then select the New Book setting.

Action Buttons

OpenMerge the files and close the dialog.
CancelClose the dialog without further changes.

Example

The dialog shown below has been opened using the browse button . It shows a number of GenStat Spreadsheet (GSH) files that have been selected to be merged into a single spreadsheet. Clicking Open on this dialog copies the file names into the file list, as shown below.

Clicking Open on the above dialog will merge the files into a single spreadsheet. The files are merged in the spreadsheet in order they appear in the list. When selecting multiple files you can use the Up and Down buttons to rearrange the order that the files will be merged in.

See Also

The JOIN procedure can be used in the command language to merge data sets.