Differences between revisions 1 and 2
Revision 1 as of 2023-06-07 18:47:30
Size: 893
Comment:
Revision 2 as of 2023-06-08 01:06:45
Size: 994
Comment:
Deletions are marked like this. Additions are marked like this.
Line 50: Line 50:
By default, value labels cannot be overwritten. The '''`add`''' option allows new values to be inserted into an existing label. The '''`replace`''' option allows existing values to be overwritten in an existing label. The '''`modify`''' option combines both.  By default, value labels cannot be overwritten. The '''`add`''' option allows new values to be inserted into an existing label. The '''`replace`''' option allows existing values to be overwritten in an existing label. The '''`modify`''' option combines both.

----



== See also ==

[[https://www.stata.com/manuals/dlabel.pdf|Stata manual for label]]

Stata Label

The label command adds labels to datasets, variables, or values.


Usage

Datasets

label data "Raw dataset"

Variables

label variable foo "foo: A variable"

Values

Value labels are not stored in the dataset itself.

To create a new value label and then attach it to a variable, try:

label define yesno 1 "Yes" 0 "No"
label copy yesno yesno2
label values foo yesno

To query the labels, try:

label dir
label list yesno yesno2

By default, value labels cannot be overwritten. The add option allows new values to be inserted into an existing label. The replace option allows existing values to be overwritten in an existing label. The modify option combines both.


See also

Stata manual for label


CategoryRicottone

Stata/Label (last edited 2023-06-08 20:22:57 by DominicRicottone)