Spreadsheet Formulas - Overview

When you enter a long variable name (in the Long name field in the Variable dialog box) that starts with an equal sign, Statistica assumes that it is a formula and will verify it for formal correctness. If the formula is formally correct, you will then be given the choice to recalculate the variable now or later. You can use variable formulas to verify data, transform a variable, recode a variable or create values of the variable based on logical conditions (e.g., =(v0<=100)*1 + (v0>100)*2 will assign a value of 1 to cases number 1 through 100 and 2 to cases above 100). Refer to variables by their names (e.g., Test1, Income) or numbers (e.g., v1, v2, v3, ...); v0 is the case number. A comment may be added to a formula following a semicolon.

Examples:

Formula

Result

=(v1+v2+v3)/3

Computes the average of the first 3 variables

=(v0<=10)*1+(v0>10)*2

Recodes cases 1-10 as 1, rest as 2

=vnormal(rnd(1),50,3)

Generates random numbers from a Normal distribution (m=50,s=3)

Note that you can click the button in this dialog in order to open the Function Wizard dialog.

From this dialog, you can choose the desired part of the formula (e.g., an operator, distribution, math function). When you click OK in this dialog, the selection is pasted in the current cursor position in the edit field.

See also: Spreadsheet Formulas - Syntax Summary, Spreadsheet Formulas - Distributions and their functions, Spreadsheet Formulas - Examples, Spreadsheet Formulas - Predefined Functions.

For details on how missing data values are handled in arithmetic and logical expressions (e.g., in case selection conditions, spreadsheet formulas), see Logical and arithmetic expressions involving missing data values always evaluate to FALSE or Missing Data.

See also, Batch Transformation Formulas.