*! version 1.0 15 July 2016
help for safeappendversion 1.0 (15 July 2016)

Title

safeappend -- A wrapper to Stata's append, automatically resolving storage type
mismatches between master and using variables by force-converting them to string variables.

Table of contents

Syntax
Description
Options
Remarks
Examples
Author
Saved results
Also see

Syntax

Syntax and all options are identical to Stata's append command, with the command name append replaced with append.
See the according help file for help, syntax examples, and usage remarks worth reading.

Description

safeappend is a wrapper for Stata's command append, automatically resolving storage type
mismatches between master and using variables by force-converting them to string variables. To do so,
safeappend compares both master and all using datasets prior to merging, and determines which variables
might lead to a storage type mismatch when merging.

Clashing variables will be force-converted using tostring
in either the master or using dataset(s), and afterwards, append will be executed (with all options specified on
invocation of safeappend passed to append). For each converted variable, a message is printed to the output.

Options

All options to Stata's append also apply to safeappend. Actually, all options are directly passed to append without evaluation.

Remarks

Note that safeappend can not determine if a tostring operation is correct and makes sense in terms of a variable's contents.
You as the user are responsible for judging if a variable in your dataset should be numeric or string. The safeappend command can not
help you on this, but is designed for data managers who want their do-files to be more robust against data type changes in raw data.

This command is part of the NEPmgmt bundle, written to help creating the NEPS dataset files.

The source code of the program is licensed under the GNU General Public License version 3 or later.
The corresponding license text can be found on the internet at http://www.gnu.org/licenses/ or in gnugpl.

Examples

All examples to Stata's append also apply to safeappend, with the command name append replaced with safeappend.

Author

Daniel Bela (daniel.bela@lifbi.de),
Leibniz Institute for Educational Trajectories (LIfBi), Germany.

Saved results

savemerge saves the following in r():

Scalars

r(usingcount) number of using datasets specified

r(convertcount_master) number of variables that have been force-converted to string in the master dataset

r(convertcount_using1) number of variables that have been force-converted to string in using dataset 1

r(convertcount_uptousing1) number of variables that have been force-converted to string all datasets up to using dataset 1

r(convertcount_using2) number of variables that have been force-converted to string in using dataset 2

r(convertcount_uptousing2) number of variables that have been force-converted to string all datasets up to using dataset 2

... ...

r(convertcount_usingN) number of variables that have been force-converted to string in using dataset N

r(convertcount_uptousingN) number of variables that have been force-converted to string all datasets up to using dataset N

Macros

r(convertlist_master) list of variables that have been force-converted to string in the master dataset (if any)

r(convertlist_using1) list of variables that have been force-converted to string in using dataset 1 (if any)

r(convertlist_uptousing1) list of variables that have been force-converted to string in all datasets up to using dataset 1 (if any)

r(convertlist_using2) list of variables that have been force-converted to string in using dataset 2 (if any)

r(convertlist_uptousing2) list of variables that have been force-converted to string in all datasets up to using dataset 2 (if any)

... ...

r(convertlist_usingN) list of variables that have been force-converted to string in using dataset N (if any)

r(convertlist_uptousingN) list of variables that have been force-converted to string in all datasets up to using dataset N (if any)

Also see

NEPSmgmt (if installed), append, data_types, tostring