Variable labels


Variable labels: describe your variables.

Variable labels document your data and make it more user-friendly.

Examples of the label variable command are shown below in a do-file.

use "q:\utilities\statatut\examfac2.dta", clear

keep facid q102_1-q102_5

/** show variable labels **/

/** remove variable labels **/

label variable q102_1 ""

label variable q102_2 ""

label variable q102_3 ""

label variable q102_4 ""

label variable q102_5 ""


/** re-create variable labels */
label var q102_1 "Staff member 1 job title"

label var q102_2 "Staff member 2 job title"

label var q102_3 "Staff member 3 job title"

label var q102_4 "Staff member 4 job title"

label var q102_5 "Staff member 5 job title"



1. How many characters long can a variable label be? Answer.

2. Can more than one variable be assigned a variable label in one label command? Answer.



1. The maximum length for a variable label is 80 characters. See help limits for this and almost every other limit in Stata.

Back to question




2. No. Only one variable can be processed in a label variable command. However, you can use a command like foreach or  forvalues to create labels for many similar variables in a single loop, which saves a lot of typing.

Back to question


Review again?


Another topic?

Wink Plone Theme by Quintagroup © 2013.

Personal tools
This is themeComment for Wink theme