Thanks as always to Kit Baum, a new version of the addinby package is now available for download from SSC. In Stata, use the ssc command to do this, or adoupdate if you already have an old version of addinby.
The addinby package is described as below on my website. In the new version, the fraddinby module now has an option sortpreserve, specifying that, at end of execution, the frame specified by the frame() option will be sorted as previously. If sortpreserve is not specified, then the frame in the frame() option will be resorted by the key variables specified by the user.
Best wishes
Roger
-----------------------------------------------------------------------------------------------------------------------------------------------------------
package addinby from https://www.rogernewsonresources.org.uk/stata16
-----------------------------------------------------------------------------------------------------------------------------------------------------------
TITLE
addinby: Add in data from a disk or frame dataset using a foreign key
DESCRIPTION/AUTHOR(S)
addinby is a "cleaner" alternative version of merge m:1, designed to
reduce the lines of code in Stata do-files. It adds variables and/or
values to existing observations in the dataset currently in memory
(the master dataset) from a Stata-format dataset stored in the file
filename (the using dataset), using a foreign key of variables
specified by the keyvarlist to identify observations in the using
dataset. These foreign key variables must identify observations in
the using dataset uniquely. Unlike merge m:1, addinby always
preserves the observations in the master dataset in their original
sorting order, and never adds any additional observations, and only
generates a matching information variable if requested to do so.
However, addinby may optionally check that there are no unmatched
observations in the master dataset, and/or check that there are no
missing values in the foreign key variables in the master dataset.
fraddinby is similar to addinby, but it adds variables from a dataset
in a data frame, instead of from a dataset in a disk file.
Author: Roger Newson
Distribution-Date: 23april2026
Stata-Version: 16
INSTALLATION FILES (click here to install)
addinby.ado
fraddinby.ado
addinby.sthlp
fraddinby.sthlp
-----------------------------------------------------------------------------------------------------------------------------------------------------------
(click here to return to the previous screen)
The addinby package is described as below on my website. In the new version, the fraddinby module now has an option sortpreserve, specifying that, at end of execution, the frame specified by the frame() option will be sorted as previously. If sortpreserve is not specified, then the frame in the frame() option will be resorted by the key variables specified by the user.
Best wishes
Roger
-----------------------------------------------------------------------------------------------------------------------------------------------------------
package addinby from https://www.rogernewsonresources.org.uk/stata16
-----------------------------------------------------------------------------------------------------------------------------------------------------------
TITLE
addinby: Add in data from a disk or frame dataset using a foreign key
DESCRIPTION/AUTHOR(S)
addinby is a "cleaner" alternative version of merge m:1, designed to
reduce the lines of code in Stata do-files. It adds variables and/or
values to existing observations in the dataset currently in memory
(the master dataset) from a Stata-format dataset stored in the file
filename (the using dataset), using a foreign key of variables
specified by the keyvarlist to identify observations in the using
dataset. These foreign key variables must identify observations in
the using dataset uniquely. Unlike merge m:1, addinby always
preserves the observations in the master dataset in their original
sorting order, and never adds any additional observations, and only
generates a matching information variable if requested to do so.
However, addinby may optionally check that there are no unmatched
observations in the master dataset, and/or check that there are no
missing values in the foreign key variables in the master dataset.
fraddinby is similar to addinby, but it adds variables from a dataset
in a data frame, instead of from a dataset in a disk file.
Author: Roger Newson
Distribution-Date: 23april2026
Stata-Version: 16
INSTALLATION FILES (click here to install)
addinby.ado
fraddinby.ado
addinby.sthlp
fraddinby.sthlp
-----------------------------------------------------------------------------------------------------------------------------------------------------------
(click here to return to the previous screen)
