* Merge data. * Concatenate. data list list / dsid (f4.0) animal (a8) count. begin data. 1.00 antelope 23.00 1.00 bear 15.00 1.00 deer 12.00 1.00 cougar 8.00 end data. dataset name A. data list list / dsid (f4.0) animal (a8) count. begin data. 2.00 eagle 25.00 2.00 fishhawk 14.00 2.00 giraffe 9.00 2.00 hippo 10.00 end data. dataset name B. add files /file=A /file=B. execute. dataset name addvars window=front. dataset close addvars. dataset activate A window=front. * A variation is to add observations to the active window. add files /file=* /file=B. execute. * Another variation: not all the variables are common. data list list / dsid (f4.0) animal (a8) count. begin data. 1.00 antelope 23.00 1.00 bear 15.00 1.00 deer 12.00 1.00 cougar 8.00 end data. dataset name A. data list list / dsid (f4.0) animal (a8). begin data. 2.00 eagle 2.00 fishhawk 2.00 giraffe 2.00 hippo end data. dataset name B. add files /file=A /file=B. execute. dataset name addvars window=front. * Where formats, variable labels, or value labels conflict, the first one that is not missing (null) wins. data list list / dsid (f1.0) animal (a8) count. begin data. 1.00 antelope 23.00 1.00 bear 15.00 1.00 deer 12.00 1.00 cougar 8.00 end data. variable labels animal "Antelope thru deer". dataset name A. data list list / dsid (f4.0) animal (a8). begin data. 2.00 eagle 2.00 fishhawk 2.00 giraffe 2.00 hippo end data. variable labels animal "Eagle thru hippo" /dsid "Second ID". dataset name B. add files /file=A /file=B. execute. dataset name addvars window=front. * Where types conflict ADD FILES fails. data list list / dsid (a4) animal (a8) count. begin data. 1.00 antelope 23.00 1.00 bear 15.00 1.00 deer 12.00 1.00 cougar 8.00 end data. dataset name A. data list list / dsid (f4.0) animal (a8). begin data. 2.00 eagle 2.00 fishhawk 2.00 giraffe 2.00 hippo end data. dataset name B. /* Fails due to error*/ add files /file=A /file=B. execute. *ERROR here. dataset name addvars window=front. *This applies to the wrong window. * Where types conflict ADD FILES fails - different string lengths. data list list / dsid (f1) animal (a8) count. begin data. 1.00 antelope 23.00 1.00 bear 15.00 1.00 deer 12.00 1.00 cougar 8.00 end data. dataset name A. data list list / dsid (f1) animal (a6). begin data. 2.00 eagle 2.00 fishhawk 2.00 giraffe 2.00 hippo end data. dataset name B. /* Fails due to error*/. add files /file=A /file=B. execute. *ERROR here. dataset name addvars window=front. *This applies to the wrong window.