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

Scripts - System variables

System variables are predifined variables that set options and control program operation. They always start with a $ symbol. System variable names, as other variable names, functions and commands in MedCalc, are case-insensitive.

System variables can be changed, and can be used in calculations, conditional statements, etc.

General system variables

$DecimalSymbolThe character used as decimal symbol (see Regional settings).
$ListSeparatorThe character used as list separator (see Regional settings).
$PrecisionIncThe "precision increment" as set in Reports options.
$ChronoA timer in milliseconds. The timer has a resolution in the range of 10 milliseconds to 16 milliseconds.

System variables that control the spreadsheet

$CenturyThe default century when entering dates without the century (as set in Spreadsheet options).
$DefaultAlignmentThe default alignment in the MedCalc spreadsheet, as set in Format spreadsheet. Possible values: RIGHT | LEFT | CENTER.
$DefaultColumnwidthThe default column width of the MedCalc spreadsheet, as set in Format spreadsheet.
$DefaultPrecisionThe default precision (number of decimals) of the MedCalc spreadsheet, as set in Format spreadsheet.
$ListSeparatorThe character used as list separator (see Regional settings).

System variables used in Custom dialogs:

$DlgVar1 .. $DlgVar4The variables selected in a custom dialog box.
$DlgFilterThe filter selected in a custom dialog box.
$Covariates[1..24]The covariates selected in a custom dialog box
$Option1 .. $Option5Options selected in a custom dialog box.
$Input .. $Input4Values entered in a custom dialog box.

System variables that control script execution

$OutputWhen set to MAIN, output, reports, and graphs are displayed in the MedCalc main window. When set to CONSOLE, reports and graphs are displayed in the output frame of the scripts window. When set to OFF, reports and graphs are not displayed. When set to ON, the output setting is reset to its previous state, before OFF (reset to MAIN or CONSOLE).
$AutoloadThis variable is set to TRUE by MedCalc during execution of an Autoload script.

System variables that set graph options

$ColorSchemePossible values: [1..4]
$GraphFontFont name
$DisplayGridpossible values: TRUE | FALSE
$PlotAreaBorderXYonlypossible values: TRUE | FALSE
$OutsideTickmarkspossible values: TRUE | FALSE
$Jitterpossible values: TRUE | FALSE
$TitleGraph title (top) (*)
$XTitleText below X-axis (*)
$YTitleVertical text left of Y-axis(*)

(*) If $Title is empty, the default title is used. If $Title="NULL" then there will be no title in the graph.

System folders

$DataPathFolder where data files are stored
$GraphsPathFolder where image files are stored
$TextPathFolder where text files are stored
$ScriptsPathFolder where scripts are stored

See also