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 Show menu

Variables

1. The basic variable: column heading

These variables refer directly to columns in the spreadsheet. The name of the variable is the heading you enter for the column in the spreadsheet.

If you have the following data in the spreadsheet:

Data sheet

then ID_NR, TREATMENT, AGE, HEIGHT and WEIGHT are valid variables.

Remember that a variable name should not include spaces, nor the following characters: - + / * = < > # & @ $ | ^ : , ; . ( ) ' " [ ] { }. In addition, the variable name should not be a number, not start with a number and it must be different from reserved words such as TRUE, FALSE, ROW and COLUMN. Finally, it should not be equal to the address of a spreadsheet cell such as A1, S1, AB35, IL6, etc.

2. Combination of variables

When performing statistical analyses or creating graphs, you can enter a combination of variables as a variable in the dialog panels:

Combination of variables

In this example, the variables WEIGHT and HEIGHT are combined into a new variable (the Body Mass Index) with the formula WEIGHT/(HEIGHT*HEIGHT). Any of the following operators can be used to combine variables (in order of precedence):

^Exponentiation
-Negation
* /Multiplication, Division
+ -Addition, subtraction

As shown in the example, brackets can be used to change the operators' precedence.

When the cursor (the focus) is on a Variable selector, then you can press function key F8 to call the Variable formula editor for an easy to use formula editor.

3. Transformation of a variable

When a variable needs transformation, you can use one of the many MedCalc spreadsheet functions. For example, if a variable needs square root transformation you use the SQRT(variable) function as new variable:

Transformation of a variable using a mathematical function

Note:

  • The formula WEIGHT/(HEIGHT*HEIGHT) can also be written using the POWER function as: WEIGHT/POWER(HEIGHT,2)
  • there is no space between the function name SQRT, POWER, etc., and the opening bracket (.
  • when a function requires more than one argument, these arguments are separated by the list separator that is selected in the Windows settings (Control panel - Regional settings - Number). Usually this is a comma (as in the examples in this help file), but in European countries the list separator commonly is a semicolon ";". In the latter case, the above example should be written as: WEIGHT/POWER(HEIGHT;2).

See also