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 - list of commands and constructs

Alert(message[,buttons]) generates a message on the screen.

AppendColumn(tname,vrow1,vrow2,...) adds a column at the right side of a table.

AppendColumn(tname,matrix) adds the values of a matrix at the right side of a table.

AppendFile(filename) opens the file with name filename (new text is appended to the existing file).

AppendRow(tname,vcol1,vcol2,...) appends a row to a table.

AppendRow(tname,matrix) appends the values of a matrix at the bottom of a table.

Beep generates a computer beep.

Bootstrap(procedure,loops,matrixname) creates a matrix containing the bootstrap sampling distribution of various parameters estimated in a statistical procedure.

BootstrapCI(procedure,loops,ci,tablename) creates a table containing ci% bootstrap confidence intervals of various parameters estimated in a statistical procedure.

BootstrapBCaCI(procedure,loops,ci,tablename) creates a table containing bias-corrected and accelerated (BCa) bootstrap ci% intervals of various parameters estimated in a statistical procedure.

BoxCoxParams(var[,filter],lambda,shift) estimates an optimal value for Lambda and shift paramater for a Box-Cox or power transformation.

Break interrupts a loop.

Clear covariates clears the system variables $covariates[1] to $covariates[24].

Clear data clears all spreadsheet data.

Clear mem deletes or clears all workspace variables.

CloseFile(filename) closes the file for writing.

CloseMainWindow closes the MedCalc main window.

CloseScriptWindow closes the script window.

Cls clears the content of the output frame.

Continue breaks one iteration in a loop.

Copy(var) copies the contents of var to the Windows clipboard.

CreateColumn(name) creates a new spreadsheet variable in a free spreadsheet column with column header name.

CreateFile(filename) creates a text file

CreateHTML(filename) creates a html file

<Data> </Data> defines a data block.

DefineStatus(variable,value,positive) defines a status for a dichotomous outcome variable.

Delay(msec) delays execution of the script.

<Dialog> </Dialog> defines a custom dialog box.

Dialog() displays a custom dialog box.

Do { statementblock; } while (condition); the statement block is executed until the condition is not true.

Echo ON | OFF turns on or off the command echoing feature.

Exec(command) executes the given command.

FileList([path,][mask]) lists files into a table.

FillColumn(column,fromrow,torow,content,emptyonly[,convertformula]) fills a column in the spreadsheet.

For (initialization; condition; increment) { statementblock; } the statement block is executed a number of times.

ForEach enumeration [sort] as variablename { statementblock; } the ForEach loop is executed for each element in the enumeration. In each loop, the element of the enumeration is assigned to the workspace variable variablename

FormatTable(tname,formatstring) formats a table.

FormatTableCell(tname,row,column,formatstring) formats a table cell.

FormatTableColumn(tname,column,formatstring) formats a table column.

FormatTableRow(tname,row,formatstring) formats a table row.

Function myfunc([param1,param2,...]) declares a function.

GetOpenFilename([path,][mask]) displays a dialog in which the user can select a file for reading; the function returns the selected file.

GetSaveFilename([path,][mask]) displays a dialog in which the user can select a file for writing; the function returns the selected file.

Global(variable1[,variable2) marks the listed variables used in a function as global.

Halt stops execution of the script.

If (condition) { statementblock; } executes the statement block conditionally.

Input(message,type) creates a dialog box for a single input.

Jackknife(procedure,matrixname) creates a matrix containing the jackknife sampling distribution of various parameters estimated in a statistical procedure.

JackknifeSE(procedure,tablename) creates a table containing the jackknife estimates of bias and standard error.

LocateColumn(name) locates the column with column header name in the spreadsheet, and returns the column number.

Loop { statementblock; } statements inside the loop are executed repeatedly.

Paste(column[,row]) places the content of the clipboard in the spreadsheet at the coordinates column and row.

PrependColumn(tname,vrow1,vrow2,...) inserts a column at the left side of a table.

PrependColumn(tname,matrix) inserts the values of a matrix at the left side of a table.

PrependRow(tname,vcol1,vcol2,...) inserts a row at the top of a table.

PrependRow(tname,matrix) inserts the values of a matrix at the top of a table.

Print(foo) prints the value or variable foo in the command console.

PrintLn advances the cursor in the output frame to the next line.

Proc(procedure[,tablename]) invokes a statistical procedure or graph.

Randomize(seed) resets the MedCalc random number generator.

ReadData(filename) loads a datafile into the spreadsheet.

Return returns a value from a function.

SaveData(filename) saves the spreadsheet data.

SaveGraph(filename, graphid) saves a graph on disk.

SelectFolder() displays a dialog in which the user can select a disk folder; the function returns the selected folder.

SetColumnDefault(column,content) sets a default value or formula for a column in the spreadsheet.

SetColumnFormat(column,format) sets the format of the spreadsheet column column.

Table(tname) creates a table in memory.

ViewFile(filename) opens the file in a web browser.

While (condition) { statementblock; } the statement block is executed while a condition is true.

Write(filename,data) writes the data as text to a file.

WriteLn(filename) writes a new line to a file.

See also