Case Selection Conditions - Overview

Select Edit from the Tools - Selection Conditions submenu to display the Case Selection Conditions dialog box, which contains options to include only a subset of cases in an analysis (that is, use case filters).

The conditions entered in the Case Selection Conditions dialog box are used to select cases for analyses, and if saved to a file, they are stored along with their header in a compressed file format. However, the saved conditions can also be used in (that is, opened into) all those dialog boxes where multiple sets of case selection conditions are entered to identify multiple subsets of data (example, Recode Values of Variable and Verify Data).

Note: Case selection conditions can also be specified for only the current analysis or graph (and hence not be tied to the current data file) by clicking the Select Cases button to display the Analysis/Graph Case Selection Conditions dialog box. This button is included in all Startup Panels and all analysis or graph definition dialog boxes that are displayed before the data processing begins.

Selection Conditions and Graph Auto Updating

Graphs created with the Update from Spreadsheet option (on the Options 1 tab of the graph specifications dialog box) enabled are updated (either automatically or manually) to reflect spreadsheet data changes. Selection conditions are treated as a change in the data.  

Graphs created through the Graphs menu default to the Use current Spreadsheet selection conditions option available in the Analysis/Graph Case Selection Conditions dialog box. When this option is used in conjunction with the Update from Spreadsheet option, the graph update includes the current spreadsheet selection conditions at the time of the update.

The graph analyses also allows the Use selection conditions for this analysis/Graph only option to be selected in the Analysis/Graph Case Selection Conditions dialog box. When this option is used in conjunction with the Update from Spreadsheet option, the selection conditions specified during the analysis is maintained during a graph update, overriding any spreadsheet selection condition changes.

Case selection conditions and missing data

 A case is automatically excluded (that is, not selected by the current case selection conditions) if it has missing data for any of the variables used in the expression defining the case selection condition. So, for example, if you included cases with the condition Include if v1=1 or v2=1, and missing data are encountered for a case for variable 2 (v2), the respective case is not selected regardless of the value of v1 (that is, even if v1=1 evaluates to True).

Note: The case selection conditions are ignored by the spreadsheet formulas.
See also: Case Selection Conditions Syntax Summary and Case Selection Conditions Examples.

For details on how missing data values are handled in arithmetic and logical expressions (example, in case selection conditions, spreadsheet formulas), see Logical and Arithmetic Expressions Involving Missing Data Values Always Evaluate to FALSE or Missing Data.

Selection Using Dates

Statistica can select cases based on dates by enclosing the date with # symbols. For example, if you want to select the week of January 18 through 24, 2009, for variable 6, the case selection condition is: v6>=#11/18/2009# AND v6<=#11/24/2009#. Time functions can also be used with this selection method, for example: v6 > #3/5/07 12:03AM#.

Variables and text values

In the event that a conflict arises between a variable name and text values of another variable (example, a data set has one variable named "Cats" and another variable that has a text value of "Cats"), the variable name takes precedence over the text value. To specify the text value in selection conditions, append a $ to the end of the text value (example, "Cats"$).