You are on page 1of 1

Value Labels

The foreign variable appears to contain text, like make. But note that it's a different color, and if
you click on a cell in that column what appears at the top of the browser is a 0 or a 1. This tells
you foreign is really an numeric variable with a set of value labels applied. Comparing the
numbers at the top with the words in the table, you'll see that this set of value labels associates
the number 0 with the word "Domestic" and the number 1 with the word "Foreign." We'll talk
about creating value labels in Creating and Changing Variables. But for now, the important thing
to remember is that if you write code referring to the foreign variable, it must use the
values 0 and 1, not the labels "Domestic" and "Foreign."

Note that a 1 means "Yes, this car is foreign" and a 0 means "no, this car is not foreign." Stata
generally uses 1 for true and 0 for false, and if you follow that convention indicator variables will
be clear even without value labels.

Missing Values
Several cars have dots in the rep78 column rather than numbers. These indicate missing values.
A Stata data set is a rectangular matrix, so every observation must have something for every
variable. If no actual data are available, Stata stores a code for "missing." While this data set just
uses "generic" missing values, there are 26 others you can use: .a through .z. Stata treats them all
the same, but you can assign meanings to them. For example, if you were working with a survey
you might decide to code "the question did not apply" as .a and "the respondent refused to
answer" as .b.

You might also like