Thanks once ag/ain to Kit Baum, new versions of the packages descsave, xcontract, xdir and xsvmat are now available for download from SSC. In Stata, use the ssc command to do this, or adoupdate if you already have old versions of these pckages.
The packages descsave, xcontract, xdir and xsvmat are Stata 16 resultsset-generating packages with a frame() option to allow the user to output the resultsset to a data frame. The new versions (described as below on my website) now fail informatively if the user attempts to specify a frame() option specifying the current data frame, in which case the user is advised to use the options norestore or fast.
Best wishes
Roger
----------------------------------------------------------------------------------------------
package descsave from http://www.rogernewsonresources.org.uk/stata16
----------------------------------------------------------------------------------------------
TITLE
descsave: Save descriptive attributes of variables to a do-file and/or a Stata dataset
DESCRIPTION/AUTHOR(S)
descsave is an extended version of describe, which lists descriptive
attributes for a list of variables in a dataset given by varlist, or for all
variables in the dataset if varlist is not specified. The dataset is the
current dataset in memory, unless using is used to specify a dataset in a
file. The descriptive attributes are variable names, storage types, display
formats, value labels and variable labels (as output by describe), and also
(optionally) a list of characteristics specified by the charlist() option.
descsave creates an output Stata dataset (or resultsset) with one observation
per variable and data on these descriptive attributes. This dataset may be
listed using the list() option and/or saved to a data frame using the frame()
option and/or saved to a file using the saving() option and/or written to the
memory using the norestore or fast option, overwriting any existing dataset.
The file specified by dofile() is a do-file, containing commands which can be
run to reconstruct the descriptive attributes of the variables, assuming that
variables of the same names have been created and are numeric or character as
appropriate. descsave can be used together with export delimited to create a
definitive generic spreadsheet version of the current dataset, together with
a Stata do-file to reconstruct the descriptive attributes of the variables
after the spreadsheet has been input using import delimited.
Author: Roger Newson
Date: 08 April 2020
Stata version: 16
INSTALLATION FILES (click here to install)
descsave.ado
descsave.sthlp
----------------------------------------------------------------------------------------------
(click here to return to the previous screen)
----------------------------------------------------------------------------------------------
package xcontract from http://www.rogernewsonresources.org.uk/stata16
----------------------------------------------------------------------------------------------
TITLE
xcontract: Create dataset of variable combinations with frequencies and percents
DESCRIPTION/AUTHOR(S)
xcontract is an extended version of contract. It creates an output
data set with 1 observation per combination of values of the
variables in varlist and data on the frequencies and percents of
those combinations of values in the existing data set, and,
optionally, the cumulative frequencies and percents of those
combinations. If the by() option is used, then the output data set
has one observation per combination of values of the varlist
variables per by-group, and percents are calculated within each
by-group. The output data set created by xcontract may be listed to
the Stata log, or saved to a data frame, or saved to a disk file, or
written to the memory (overwriting any pre-existing data set).
Author: Roger Newson
Distribution-Date: 08april2020
Stata-Version: 16
INSTALLATION FILES (click here to install)
xcontract.ado
xcontract.sthlp
----------------------------------------------------------------------------------------------
(click here to return to the previous screen)
----------------------------------------------------------------------------------------------
package xdir from http://www.rogernewsonresources.org.uk/stata16
----------------------------------------------------------------------------------------------
TITLE
xdir: Create a resultsset with 1 observation per file in a directory
DESCRIPTION/AUTHOR(S)
xdir is an extended version of dir, or of the extended macro function
dir. It creates an output dataset (or resultsset), with 1 observation
for each file in a user-specified directory conforming to a
user-specified pattern, and belonging to a user-specified file type,
and data on the file name and the directory name. This dataset may be
listed using the list() option and/or saved to a data frame using the
frame() option and/or saved to a file using the saving() option and/or
written to the memory using the norestore or fast option, overwriting
any existing dataset. Alternatively (or additionally), a list of the
file names may be saved in a local macro, using the local() option or
the plocal() option.
Author: Roger Newson
Distribution-Date: 08april2020
Stata-Version: 16
INSTALLATION FILES (click here to install)
xdir.ado
xdir.sthlp
----------------------------------------------------------------------------------------------
(click here to return to the previous screen)
----------------------------------------------------------------------------------------------
package xsvmat from http://www.rogernewsonresources.org.uk/stata16
----------------------------------------------------------------------------------------------
TITLE
xsvmat: Convert a matrix to variables in an output dataset
DESCRIPTION/AUTHOR(S)
xsvmat is an extended version of svmat. It creates an output
dataset (or resultsset), with one observation per row of either an
existing matrix or the result of a matrix expression, and data on
the values of the column entries in that row, and, optionally,
extra variables specified by the user. The output dataset created
by xsvmat may be listed to the Stata log, or saved to a data
frame, or saved to a disk file, or written to the memory
(overwriting any pre-existing dataset).
Author: Roger Newson
Distribution-Date: 08april2020
Stata-Version: 16
INSTALLATION FILES (click here to install)
xsvmat.ado
xsvmat.sthlp
----------------------------------------------------------------------------------------------
(click here to return to the previous screen)
The packages descsave, xcontract, xdir and xsvmat are Stata 16 resultsset-generating packages with a frame() option to allow the user to output the resultsset to a data frame. The new versions (described as below on my website) now fail informatively if the user attempts to specify a frame() option specifying the current data frame, in which case the user is advised to use the options norestore or fast.
Best wishes
Roger
----------------------------------------------------------------------------------------------
package descsave from http://www.rogernewsonresources.org.uk/stata16
----------------------------------------------------------------------------------------------
TITLE
descsave: Save descriptive attributes of variables to a do-file and/or a Stata dataset
DESCRIPTION/AUTHOR(S)
descsave is an extended version of describe, which lists descriptive
attributes for a list of variables in a dataset given by varlist, or for all
variables in the dataset if varlist is not specified. The dataset is the
current dataset in memory, unless using is used to specify a dataset in a
file. The descriptive attributes are variable names, storage types, display
formats, value labels and variable labels (as output by describe), and also
(optionally) a list of characteristics specified by the charlist() option.
descsave creates an output Stata dataset (or resultsset) with one observation
per variable and data on these descriptive attributes. This dataset may be
listed using the list() option and/or saved to a data frame using the frame()
option and/or saved to a file using the saving() option and/or written to the
memory using the norestore or fast option, overwriting any existing dataset.
The file specified by dofile() is a do-file, containing commands which can be
run to reconstruct the descriptive attributes of the variables, assuming that
variables of the same names have been created and are numeric or character as
appropriate. descsave can be used together with export delimited to create a
definitive generic spreadsheet version of the current dataset, together with
a Stata do-file to reconstruct the descriptive attributes of the variables
after the spreadsheet has been input using import delimited.
Author: Roger Newson
Date: 08 April 2020
Stata version: 16
INSTALLATION FILES (click here to install)
descsave.ado
descsave.sthlp
----------------------------------------------------------------------------------------------
(click here to return to the previous screen)
----------------------------------------------------------------------------------------------
package xcontract from http://www.rogernewsonresources.org.uk/stata16
----------------------------------------------------------------------------------------------
TITLE
xcontract: Create dataset of variable combinations with frequencies and percents
DESCRIPTION/AUTHOR(S)
xcontract is an extended version of contract. It creates an output
data set with 1 observation per combination of values of the
variables in varlist and data on the frequencies and percents of
those combinations of values in the existing data set, and,
optionally, the cumulative frequencies and percents of those
combinations. If the by() option is used, then the output data set
has one observation per combination of values of the varlist
variables per by-group, and percents are calculated within each
by-group. The output data set created by xcontract may be listed to
the Stata log, or saved to a data frame, or saved to a disk file, or
written to the memory (overwriting any pre-existing data set).
Author: Roger Newson
Distribution-Date: 08april2020
Stata-Version: 16
INSTALLATION FILES (click here to install)
xcontract.ado
xcontract.sthlp
----------------------------------------------------------------------------------------------
(click here to return to the previous screen)
----------------------------------------------------------------------------------------------
package xdir from http://www.rogernewsonresources.org.uk/stata16
----------------------------------------------------------------------------------------------
TITLE
xdir: Create a resultsset with 1 observation per file in a directory
DESCRIPTION/AUTHOR(S)
xdir is an extended version of dir, or of the extended macro function
dir. It creates an output dataset (or resultsset), with 1 observation
for each file in a user-specified directory conforming to a
user-specified pattern, and belonging to a user-specified file type,
and data on the file name and the directory name. This dataset may be
listed using the list() option and/or saved to a data frame using the
frame() option and/or saved to a file using the saving() option and/or
written to the memory using the norestore or fast option, overwriting
any existing dataset. Alternatively (or additionally), a list of the
file names may be saved in a local macro, using the local() option or
the plocal() option.
Author: Roger Newson
Distribution-Date: 08april2020
Stata-Version: 16
INSTALLATION FILES (click here to install)
xdir.ado
xdir.sthlp
----------------------------------------------------------------------------------------------
(click here to return to the previous screen)
----------------------------------------------------------------------------------------------
package xsvmat from http://www.rogernewsonresources.org.uk/stata16
----------------------------------------------------------------------------------------------
TITLE
xsvmat: Convert a matrix to variables in an output dataset
DESCRIPTION/AUTHOR(S)
xsvmat is an extended version of svmat. It creates an output
dataset (or resultsset), with one observation per row of either an
existing matrix or the result of a matrix expression, and data on
the values of the column entries in that row, and, optionally,
extra variables specified by the user. The output dataset created
by xsvmat may be listed to the Stata log, or saved to a data
frame, or saved to a disk file, or written to the memory
(overwriting any pre-existing dataset).
Author: Roger Newson
Distribution-Date: 08april2020
Stata-Version: 16
INSTALLATION FILES (click here to install)
xsvmat.ado
xsvmat.sthlp
----------------------------------------------------------------------------------------------
(click here to return to the previous screen)