*! version 1.0.1 14Feb2017

Title

explorelabs -- explores value labels and shows their frequency and assigned values.

Syntax

explorelabs varlist [, options]

Explore modus
lastvalues(#) explore only value labels attached to the last (highest) # values of varlist

negative explore only value labels attached to negative values of varlist

Output
frequency show frequency of value labels according to explore modus

labeltext(string) limit output only to value labels matching string

list list each variable of varlist, its values and labels according to explore modus

Description

explorelabs explores the value labels of every variable named in varlist and gives an overview of their use by reporting specific labels, their frequency and values being attached to those labels.
explorelabs offers two explore modes. By using the option lastvalues(#) the user can decide how many values of a scale are reported. This can
be useful if a missing value scheme is applied that always refers to the last/highest values of a variable. The second mode is negative and does the same as lastvalues(#) but for
negative values only. Be aware that these modes only look at values having labels attached. Thus, values having no label at all are not considered. However, if the label is
specified as " "(one blank minimum) it is taken into account. If both options are not used explorelabs looks at all labels available.

Two different outputs can be obtained. Either a list of variables and their values and labels (list)
or a table of labels, their frequency and all their values attached to them (frequency). As a default both outputs are shown. Furthermore, labeltext(string) enables the user
to limit the output to only those labels matching the string expression (see strmatch() for matching patterns).

Please note: Depending on the amount of defined labels in varlist explorelabs surely can take its time. Don't despair and get yourself your favourite hot/cold beverage.

Options

Explore mode

lastvalues(#) takes the last (highest) values of a variable named in varlist into account. The amount of values to look at is chosen by defining (#) as an integer greater than zero. For example,
using lastcodes(2) makes explorelabs to report only the last two values of every variable in varlist and so on. Thus, the user is able to investigate if missing value labels (including stata missing values
like .a, .b, because they are defined es great numbers) are always attached to the last values of a variable. This would be the case if e.g. the label "no answer" appears many times but with different values attached.
If the variable does not contain as many values as the user is calling for all value labels are displayed. If this option or negative are not called explorelabs looks at all labels of varlist.

negative takes only negative values of a variable named in varlist into account. Thus, the user can investigate if a missing scheme is applied that only uses negative values. Furthermore, in combination with
frequency it can be explored if this scheme is applied correctly, meaning that every label should have attached only one value. If this option or lastvalues(#) are not called explorelabs looks at all labels of varlist.

Output

frequency provides some descriptive statistics of the labels being used in the dataset. It lists every unique label attached to the investigated values (set by explore mode) in
an alphabetical order and shows the frequency of each label and which values are attached to it.

labeltext(string) enables the user to limit the reported labels to those that match the string expression. As in other string functions (e.g. strmatch()) this expression can contain placeholders
like "*" or "?". labeltext(string) can be applied to both kinds of outputs.

list gives back every variable with a value label, lists their called on labels (negative or last # values) and underlines those labels being also actually in the dataset as observations.

Examples

Explore every label of varlist and get the full output:

. explorelabs varlist

Explore the last two values of varlist and only list them:

. explorelabs varlist, lastvalues(2) list

Explore the last two values of varlist and only get their frequencies:

. explorelabs varlist, lastvalues(2) frequency

Explore only negative values of varlist, list them and get their frequencies (e.g. to control if a missing value scheme of negative values has only exactly one value attached to a label):

. explorelabs varlist, negative

Explore only those labels that contain "answer", take all labels into account and get their frequencies:

. explorelabs varlist, frequency labeltext(*answer*)

Author

Malte Kaukal, Hessen State Statistical Office malte.kaukal@gmx.de

Thank you for citing this software as follows:

Kaukal, Malte.2017. EXPLORELABS: Stata module to explore the use of value labels. Available from https://EconPapers.repec.org/RePEc:boc:bocode:s458299.

Acknowledgement

Regarding processing through each single value label this ado benefits a lot from the ado labellist written by Daniel Klein.

I would like to acknowledge the support of GESIS, which led to the creation of the Stata command explorelabs.
Further I would like to thank my colleagues for their thoughtful comments and tests of earlier versions.