Module 4 Labeling Values in our Dataset
Although it is customary to use Stata’s Data Editor for defining and applying labels, the Variable manager can be a rather useful option for this task. In this module, we will explore how to label values of data set variables, and we will use the Variable manager to accomplish this. By the end of this module, students should:
- become familiar with basic requirements and or procedures of labeling values of some variables in a data set
- be able to use Stata’s Variable manager feature to label variable values in a data set
The Variable manager feature can be brought up by clicking the spreadsheet icon on Stata’s toolbar, as shown below:

Figure 1.7. Variable manager icon
We will open the Variables Manager and define a value label for one of the variables in our data set, study_level (which describes respondents level of study, i.e either graduate, undergraduate or diploma). In this activity, we will use the Variables Manager to define the value labels. Let’s start.
In the Variable Properties pane, click on the Manage… button next to the Value label field (see figure 1.8).

Figure 1.8. Variable manager showing manage property in the Properties pane
This will open a new dialog box called Manage value labels (again see figure 1.9 below)

Figure 1.9 Manage Value Labels dialog
Because we have no value labels yet, nothing is listed. Click on Create label, and the Create label dialog box opens as shown in figure 2.0.

Figure 2.0. Create Label dialog
For Label name, type Study. Bear in mind that this is not the name of the variable but a sort of sobriquet for the set of labels we will use for the variable. For Value, type 1; press on Tab button to go to Label (you can also click inside the Label box if you don’t want to use Tab, and start typing) and type graduate; and then click Add. Next type 2 under Value; press the Tab button to go to Label and type undergraduate and then click Add. Again, type 3 under value then Tab to Label for the final time and type diploma then click Add. See figure 2.1 for a screen shot of the results:

Figure 2.1. Create Label dialog output
Figure 2.1 shows the Create Labels dialog box after performing the activities above. Since we have no more values, click on OK to close the Create label dialog box. Doing this adds the label study to the Manage value labels dialog box. Now click on the Close button of the Manage value labels dialog box to return to the Variables Manager. In the Variable Properties pane, we can click on the drop-down menu for Value label and select our label of study. Then click on Apply. You will notice that the value label for study_level is now study in the list of variables on the left.
Now using what we have learned so far, let us define more value labels for our data set:
- click on the Manage… button next to Value label,
- then click on Create label, which opens the Create label dialog box.
- Let us make a label sobriquet of Views that we will apply to tuition_hike. This new label is intended to describe respondents’ views of the new tuition hike introduced by the Newfoundland government.
- For Value, type 1;
- tab to Label and type Very Unfair;
- then click on Add.
- Repeat this step to add the following values and labels for the views value label:
values | Labels |
---|---|
2 | Fair |
3 | I’m not sure |
4 | Unfair |
5 | Very Unfair |
Let us repeat these steps, starting by clicking on Create Label, and create value labels named status (fee_status), sex (gender), impacts (effects), and funding (fee_type) with the following values and labels:
Label name | Value | Label |
---|---|---|
sex | 1 | Male |
2 | Female | |
3 | Other | |
4 | Prefer not to say | |
status | 1 | canadian/permanent resident |
2 | international student | |
impacts | 1 | Very affected |
2 | Affected | |
3 | Not sure | |
4 | Slightly affected | |
5 | Not affected at all | |
funding | 1 | Self-funded |
2 | Scholarship | |
3 | Prefer not to say |
- Once we finish creating the last value label, we then click on Close in the Manage value labels dialog box. This takes us back to the Variables Manager.
- Here we can click on any variable - for example, gender, then click on the drop-down menu next to Value label and select one of the sobriquets we just created, in this case, sex. Clicking on Apply will assign this set of value labels to the gender variable. We can repeat this for fee_status by selecting status from the drop-down menu. Similarly, we can select impacts for effects, study for study_level, views for tution_hike and finally, funding for fee_type.
Finally, let us add a note to our dataset. To do this,
- bring up the Variable manager if it is not already the active window,
- and right-click on any of the variables, for example, id.
- A drop-down menu appears with several useful options including Manage notes for dataset… Click on this option, and we see a dialog box open with an option to add notes.
- Click on Add and then type These data were collected for my term project for POSC 3010 in March of 2015.
- Next, click on Submit and then Close to close the dialog box.
Dataset notes can be very useful for keeping track of general changes in the dataset. To see how the notes look in the data set, type this command into your Stata Command window: describe. Next, type notes. The output can be seen below:

Figure 2.2.
Going through a series of dialog boxes can be confusing. Remember however, that if you face any difficulty completing any of these tasks, I am always available to help, both in person and via email (syo837@mun.ca.)