The CALC Instruction

 

The CALC instruction lets you perform calculations on your table results. CALC can be used in row or column logic, with the calculation result being placed in the specified row or column. CALC can be performed on frequencies, vertical percents, horizontal percents, constant percents, means, standard deviations and standard errors on rows or columns.

 

IMPORTANT:

1. You cannot use a CALC statement to reference another row that uses a CALC statement.

2. Significance testing does not work on a row that uses a CALC statement.

3. You cannot percentage a row off of another row that uses a CALC statement.

4. You cannot suppress blank CALC rows.

 

The syntax of the CALC instruction is:

 

CALC Tn operator Tn

or

CALC Tn operator number

or

CALC SQRT Tn operator Tn

or

CALC SQRT Tn operator number

 

SQRT = Square root

 

T =  V (Vertical Percent)

H (Horizontal Percent)

C (Constant Percent)

F (Frequency)

M (Means)

D (Standard Deviation)

E (Standard Error)

 

n = row number or column number

operator = +, -, *, /

number = real number

 

For example, the banner logic:

 

CALC V1 + V2

 

means ‘Calculate the vertical percent of column 1 plus the vertical percent of column 2.’

 

The n (row or column number) refers to the original row number (when written in row logic) or column number (when written in banner logic) on your table. It does not refer to any report row or column number, for these may vary due to hidden rows or columns or ranking.

 

An expression can have both frequencies and percents. You can have to up three calculations per cell. Each expression must be separated by a comma.

 

The CALC instruction can be used with row and column means. Because a table mean is not a physical row, but is generated by WinCross, you cannot use the table means in a CALC instruction.

 

You can create complex expressions with braces {} to indicate which expressions should be evaluated together, as well as the order in which the expressions should be considered. You can have an unlimited number of ‘nested’ expressions (one expression within another).

 

Example 1: CALC in Banner and Row logic

 

CALC V3 - V2

 

In banner logic:

If the above example is the logic for banner column 4, the result in banner column 4 would be the vertical percent of banner column 3 minus the vertical percent of banner column 2.

 

In row logic:

If the above example is the logic for table row 4, the result in table row 4 would be the vertical percent of table row 3 minus the vertical percent of table row 2.

 

Example 2: CALC SQRT in Banner and Row logic

 

CALC SQRT {V3 - V2}

 

In banner logic:

If the above example is the logic for banner column 4, the result in banner column 4 would be the square root of the vertical percent of banner column 3 minus the vertical percent of banner column 2.

 

In row logic:

If the above example is the logic for table row 4, the result in table row 4 would be the square root of the vertical percent of table row 3 minus the vertical percent of table row 2.

 

Example 3: Add the frequency of 10 consecutive variables in a CALC statement for Banner and Row logic

 

CALC F1 A10

 

In banner logic:

If the above example is the logic for banner column 11 the result in banner column 11 would be the frequency of banner columns 1-10 added together.

 

In row logic:

If the above example is the logic for table row 11, the result in table row 11 would be the frequency of table rows 1-10 added together.

 

Example 4: CALC with braces and using real numbers

 

CALC {V1 + V2 + V3 + V4 + V5} / 5

 

Expressions in braces are evaluated first. In this example, the vertical percent for banner columns or table rows 1, 2, 3, 4 and 5 would first be added, then divided by the real number 5.

 

Example 5: Mixing percents and frequencies

 

CALC V1 / F6

CALC {V1 + V2 + V3 + V4 + V5} / F6

CALC V1 * 1.345

 

Shown above are examples of mixing percents and frequencies within an expression.

 

Example 6: Multiple expressions

 

CALC F5 - F4, V5 - V4, H5 - H4, C5 - C4

 

Shown above is an example of multiple expressions for one cell, each separated by a comma. You can have the result of up to four calculations (as depicted in this example) per cell.