I have a categorical variable comprised of 12
levels with numerical values from 1
to 12
.
Each one of these numerical values is assigned a label. For example, 1 = heart
, 2 = brain
, 3 = liver
and so on. What i would like is to do is extract the label (heart, brain, liver) and place it into a local macro. Is this possible?
I have tried lots of different commands such as describe
and codebook
.
I have also tried the following:
levelsof var, local(diseases)
The above code gets the levels of the categorical variable var
and stores them in the local macro diseases
. However this only outputs the numerical values, that is 1,2,3,4
, not the labels.