*! version 1.11 27 August 2015
help for metacollapseversion 1.11 (27 August 2015)

Title

metacollapse -- collapse dataset to its meta-information

Table of contents

Syntax
Description
Options
Remarks
Examples
Author

Syntax

metacollapse [using filename] [, options]

Processed information
missing include missing values for frequency information

dropstrings ignore string variables

Output
humanreadable remove redundant cells from output for better readability

pathinformation additionally report filepath

noomitline when omitting values, do not insert a line telling so

nofrequencies do not report frequency information

full do not omit frequency information when encountering many values

nolabels do not report label information

alllabels do report label information for valus not found in data

Saving
outfilename(filename) do not metacollapse dataset to working file, but save it to filename

format(format) save filename in format; passed through to esave

Advanced
clear replace data in memory without warning

replace overwrite existing file without warning

round(real) round output values in units of real

threshold(integer) do not report all frequency and label information if a variable has more than integer levels

verbose give verbose output

Description

metacollapse collapses the current dataset (or, if specified, the using dataset) to its meta-information.

It reports statistical information (valid, invalid and unique values, minimum, maximum, mean, standard deviance and median), label information and frequencies for each variable contained in the data.

To achieve this, it uses Stata's routines uselabel, describe and contract; actually, with the nofrequencies and nolabels option, it is very similar to describe, replace.

Options

Processed information

missing when generating statistical and frequency information, include missing values.

This results in (a) the system missing value being counted when calculating unique values and (b) the frequency being reported for the system missing value (both: if this value is contained in the data).

Note that currently it is not possible to include and count extended (a.k.a. user-defined) missing values.

dropstrings drop string variables before collapsing dataset. In cases where information about string variables is not relevant, this option may be used.

Output

humanreadable remove redundant information from output. If the results should be easily legible for human beings (e.g. in Excel sheets), it may be preferable to include certain parameters only once per variable.

In such cases, this option may be helpful.

pathinformation in addition to the dataset filename, also include the absolute path into the output. This in some cases could be helpful to automatically process the results.

noomitline suppress inserting a line describing omitted values. This contradicst alllabels, and if both are specified, noomitline is ignored.

nofrequencies do not report frequency information in the output. This implies alllabels, if you didn't specifiy the nolabels option.

full report (instead of omit) frequency information even if there are many levels of a variable. This will override the threshold option.

nolabels do not report value label information in the output.

alllabels report value label information even if empirically there are no cases in this level of a variable.

Saving

outfilename(filename) instead of generating a working dataset with metacollapsed data, save results to filename. The data currently
in memory will be restored after the procedure. In combination with using, this option will try to restore the data in memory in any case.

If filename contains spaces or special characters, it should be specified in quotes.

The file format to save to can be specified using the format option, as defined below.

format(format) file format to save the output file to. This option is passed through to the esave command, refer to
the corresponding help file for supported formats.

Advanced

clear if the data currently in memory is not saved, replace it without warning. If not specified, an error message is triggered in such cases.

Note that this should not be needed if both using and outfilename is specified, for then the original data should be restored in any case.

replace when saving results to a file (specified by outfilename(filename)), replace filename without warning if it already exists.

If specified, but no outfilename is given, this option is ignored and a warning message is triggered.

round(real) round the reported statistical and value information in units of real.

This is implemented using Stata's round function (with the requested real being the y in the according help file), see there for details.

threshold(integer) do not report frequency information for each level of the variable if the number of levels is higher than integer.

If this option is omitted, it defaults to 20. When values are omitted, this is reported in the resulting dataset.

verbose drops verbose output during the process. Eventually needed for debugging.

Remarks

Prior to Stata 12, if you want to metacollapse an external file via the using option, you need to ensure that the system memory allocated for Stata is large enough to load the using dataset into memory.

When processing very large datasets or (even more dangerous) datasets with very large labelsets, Stata may exceed your operating system's memory limit. Unfortunately, there is no known workaround for this problem.

If one of these the case, the program will fail when trying to (temporarily) read the using dataset.

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

Get metacollapsed dataset from a dataset:

. sysuse auto

. metacollapse

Get metacollapsed dataset from a dataset and save it to a ASCII-CSV-file:

. sysuse auto

. metacollapse, outfilename(report.csv) format(ascii_comma)

Get metacollapsed dataset from an external dataset and save it to a Excel-XML-file:

. metacollapse using "/usr/local/stata/ado/base/a/auto.dta", outfilename(report.xml) format(xml_excel)

Author

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

Also see

Help: NEPSmgmt, contract, describe, esave, uselabel