Skip to main content
MedCalc
Mail a PDF copy of this page to:
(Your email address will not be added to a mailing list)
working
Show menu

How to define and use labels for the different categories of a variable

In MedCalc the preferred way to enter data on categorical data, in particular for ordered categorical data, is to use numerical codes.

Data on gender and income could for example be entered as follows:

Variable labels

In this example, gender is coded as male=1 and female=2, and income level is coded as 1=low, 2=average, and 3=high).

If you create a frequency bar chart, the chart will look like this:

Variable labels

But how can we display the labels "male", "female", and "low", "average" and "high" in the graph instead of the numbers?

Proceed as follows.

To define a variable's properties, first click Edit variables list on the Tools menu, or click Variables in the Contents bar at the left side of the MedCalc window.

Variable labels

In this dialog box you select the variable of interest and click Properties.

In the new dialog box you can define the variable properties (formula, variable label and value labels).

Variable labels

In this dialog box:

Variable labels

Proceed similarly for the variable Income:

Variable labels

Now when you recreate the frequency chart the chart will display the labels.

Variable labels

See also