*! version 1.0 2020-04-18
help desclong (vs1.0: 2020-04-18)

Title

desclong -- Creating and saving a dataset holding variable information – similar as facilitated by
the -describe- command - while including long variable labels (originally stored through the notes-characteristics).

Syntax

desclong [varlist] , name(string) [folder(string) dropvars(string) sortvars(string) clear preserve excel]

Description

desclong
is a program that creates and saves a variable information-dataset (similar to what is facilitated by the -describe- command) where originally abbreviated variable labels - with Stata holding the full
labels stored as notes-characteristics - are displayed with respect to their full length. (This situation may arise when exporting a
dataset with long variable labels to Stata, e.g. from a SAS-format, where the long labels will then be put into Stata-notes; with abbreviated
versions filling the actual Stata variable labels.)

It is mandatory to state a filename for the saved variable information-dataset;
all other options are optional.

Note that this in the above sense extends the built-in -describe- command, which it also uses internally as part of the dataset construction.

Options

name(string) Name of output dataset holding the stored variable information. Mandatory option.

folder(string) Defines the directory where to save the variable information-dataset.
The default directory is the current working directory (pwd; '.'). Full paths - absolute or relative - may be used.

dropvars(string) Defines which variables, if any, to drop from the final set of variables to be saved.
As a default, all variables are kept.

sortvars(string) Defines which variables, if any, to use for a final sort of the variable information-dataset
(through the usual sorting procedure). As a default, keep the original sort order.

clear Passed on to the corresponding -describe- option. Hence, it may be used to insist on replacing the data
in memory although edits have been made after the last save.

preserve Preserves the original data to restore it after execution of the command, i.e. running the command without
affecting the data in memory before vs. after execution of the command.

excel Additionally export the final dataset to Excel ('.xlsx') form.

Examples

1. Save variable information to a named file fname in a specified directory fpath.

. desclong	, name("fname") folder("fpath")

2. Save variable information to a named file fname in a specified directory fpath
and additionally save it as an Excel-file.

. desclong	, name("fname") folder("fpath") excel

3. Save variable information for a selected set of variables fvars* to a named file fname in a specified directory fpath.

. desclong	fvars*, name("fname") folder("fpath")

4. Save variable information to a named file fname in a specified directory fpath and return to the original data after completion.

. desclong	, name("fname") folder("fpath") preserve

5. Save variable information to a named file fname in a specified directory fpath even if the original data has been changed since last save.

. desclong	, name("fname") folder("fpath") clear

6. Save variable information to a named file fname in a specified directory fpath while also dropping the variables position and isnumeric.

. desclong	, name("fname") folder("fpath") dropvars(pos isnum)

7. Save variable information to a named file fname in a specified directory fpath while also sorting the dataset based on variables name and type.

. desclong	, name("fname") folder("fpath") sortvars(name type)

8. Save variable information to a named file fname in the default (current working) directory.

. desclong	, name("fname")

Version

Stata version 15.1.

Dependence

The command depends on the built-in Stata commands describe and export excel, respectively.

Author

Lars Ängquist

Lars.Angquist@sund.ku.dk

lars@angquist.se

Also see

Help: [help pages on] describe, export excel, notes, pwd.