# Count Occurrences: If Cases

The If Cases dialog box allows you to count occurrences of values
for a selected subset of cases, using conditional expressions. A conditional
expression returns a value of *true*, *false*, or *missing* for each case.

- If the result of a conditional expression is
*true*, the case is included in the selected subset.

- If the result
of a conditional expression is
*false*or*missing*, the case is not included in the selected subset. - Most conditional expressions use one or more of the six relational operators (<, >, <=, >=, =, and ~=) on the calculator pad.
- Conditional expressions can include variable names, constants, arithmetic operators, numeric (and other) functions, logical variables, and relational operators.

Counting Occurrences for a Subset of Cases

- From the menus choose:
- In the count occurrences dialog box, click If.
- Select Include if case satisfies condition.
- Enter the conditional expression.

- To build an expression, either paste components into the Expression field or type directly in the Expression field.

- You can paste functions or commonly used system variables by selecting a group from the Function group list and double-clicking the function or variable in the Functions and Special Variables list (or select the function or variable and click the arrow adjacent to the Function group list). Fill in any parameters indicated by question marks (only applies to functions). The function group labeled All provides a listing of all available functions and system variables. A brief description of the currently selected function or variable is displayed in a reserved area in the dialog box.
- String constants must be enclosed in quotation marks or apostrophes.
- If values contain decimals, a period (.) must be used as the decimal indicator.