Mail a PDF copy of this page to:
(Your email address will not be added to a mailing list)
Skip to main content
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 in 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:

  • Click Scan data to scan the data and to populate the list with existing values in the spreadsheet for this variable.
  • Next to each value, enter the label corresponding to this value.
  • Click the Up and Down arrow buttons to move selected rows up or down; this will influence the order in which the categories will appear in the graph.

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

This site uses cookies to store information on your computer. More info...