Scripts - Spreadsheet and spreadsheet variables commands
Clear data
Clear data clears all spreadsheet data.
DefineStatus
DefineStatus(variable,value,positive) defines a status for a dichotomous outcome variable such as used in Logistic regression, Survival, ROC curve analysis (see Define status dialog box).
For example
CreateColumn("Survival"); DefineStatus(Survival,"dead",1); DefineStatus(Survival,"alive",0);
CreateColumn
CreateColumn(name) creates a new spreadsheet variable in a free spreadsheet column with column header name.
The argument name can be a string literal, placed in quotes, or an expression. The following two examples both create a column BMI in the spreadsheet:
CreateColumn("BMI");
a="BMI"; CreateColumn(a);
LocateColumn
The function LocateColumn(name) locates the column with column header name in the spreadsheet, and returns the column number.
The argument name can be a string literal, placed in quotes, or an expression. The following example locates the column BMI in the spreadsheet:
a=LocateColumn("BMI"); print("Column number : ",a);
FillColumn
FillColumn(column,fromrow,torow,content,emptyonly[,convertformula]) fills a column in the spreadsheet table.
The parameters are as follows
- column: the column identifier, either as text ("C" for column #2) or a number. The first column, column "A", is numbered 0.
- fromrow, torow: the range of rows to fill.
- content: the content of the cells. If it is a formula, the formula should be placed in quotes.
- emptyonly: if true, only empty cell will be filled with the new content.
- convertformula: if this optional parameter is true then the cells will be filled with the calculated result of the formula; if false, the formula itself is placed in the cells.
SetColumnDefault
SetColumnDefault(column,content) sets a default value or formula for a column in the spreadsheet (see Format spreadsheet, Column tab, Default value).
This default value or formula is applied to empty cells or cells for which no value has been entered in that column.
If content is a formula, this formula should be placed in quotes.
You can get the current default value for a column (if any is set) using the ColumnDefault function.
SetColumnFormat
SetColumnFormat(column,format) sets the format of the spreadsheet column column (see Format spreadsheet, Column tab, Format).
The parameter format can be GENERAL, TEXT, DATE, TIME or DATETIME.