Combining Files

If you wish to combine multiple input files into a single output file, use the COMBINE command instead of the COPY command:


      COMBINE  *.ex1   filename.ex2  -[f[+]filename]


where *.ex1 are the input files to be combined (all in the same directory), filename.ex2 is the output file and .ex1 and .ex2 are standard extensions used to specify the file types. The parameter -[f[+]filename] is described below. The input files will be concatenated into one output file.


The syntax for this command is similar to that of the COPY command using wildcards, except that the output file specification does not contain a wildcard.


The files to be combined do not need to have identical variables and the variables do not need to be in the same order.


By default, the first file in alphabetical order becomes the "reference" file and the variables in this file and their characteristics determine the structure of the output file.  The variables in succeeding files are then matched to the first file.  If a file does not have a variable with a matching name or the type of the variable does not match, it will not be included in the output.


The switch  '-f ' allows you to specify which file will be used as the reference file.  For example, if you have file1, file2, and file3 as input and you want to use file3 instead of file1 as the reference, you would specify '-ffile3'.  Note that you use the file name without the extension.


The file name itself may contain some information about the data in the file.  For example, you might have input files with data for each state, with files named with the state name.  In such cases, you may wish to have an additional variable created from the input file names and written to the output file.  The parameter '-f+' tells Stat/Transfer to create a new variable from the input file names. This can be combined with the reference file specification.  For example, ' -f+file3' tells Stat/Transfer to use file3 as the reference file and to create a new output variable from the input file names.


All of the options used with the COPY command can be used with the COMBINE command.