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 - Statistical procedures and graphs

How to invoke a statistical procedure from a script

A MedCalc statistical procedure is invoked as follows:

  • the required system variables (parameters) are set
  • the procedure is invoked with the PROC(procname) command

By default, the results are displayed in the MedCalc script output frame.

If you do not want the reports to be displayed in the script output frame, you can set the system variable $Output to MAIN (display the reports in the MedCalc main window), or to OFF (do not display the reports at all).

For example, to obtain summary statistics for a column "BMI" in the spreadsheet, you run the following script:

$Variable="BMI";
PROC(MEANS);

For a complete list of procedures and system variables, see Parameters for statistical procedures and graphs.

Several procedures share the same system variables. For example to obtain a summary statistics report and a box-and-whisker plot for the same data, you can run the following script:

$Variable="BMI";
PROC(MEANS);
PROC(BOXWHISKER);

To apply log transformation, and apply a filter, you adapt the script as follows:

$Variable="BMI";
$Log=true;
$Filter="group='a'";
PROC(MEANS);
PROC(BOXWHISKER);

See also