The Data Table |
You can select observations in the data table by using the Find dialog box. (For a way to graphically and interactively select observations that satisfy multiple constraints, see Chapter 11, "Techniques for Exploring Data.") You can open the Find dialog box (shown in Figure 4.11) by selecting Edit Find from the main menu.
Figure 4.11: The Find Dialog Box
The following list describes each item in the Find dialog box.
For numeric variables, let be the value of the Value field and let be the value of the Use tolerance of field. (If you are not using a tolerance, then .) Table 4.1 specifies whether an observation with value for the chosen variable matches the query.
Table 4.1: Find Operations for Numeric VariablesOperation | Values Found | Missing Selected? |
---|---|---|
Equals | No | |
Less than | Yes | |
Greater than | No | |
Not equals | Yes | |
Less than or equals | Yes | |
Greater than or equals | No | |
Is missing | is missing | Yes |
To remember whether missing values match the query, recall that SAS missing values are represented as large negative numbers. Table 4.1 is consistent with the WHERE clause in the SAS DATA step.
For character variables, comparisons are performed according to the ASCII order of characters. In particular, all uppercase letters [A - Z] precede lowercase characters [a - z]. Let be the value of the Value field and let indicate that precedes in ASCII order. Table 4.2 specifies whether an observation with value for the chosen variable matches the query.
Table 4.2: Find Operations for Character VariablesOperation | Values Found | Missing Selected? |
---|---|---|
Equals | No | |
Less than | Yes | |
Greater than | No | |
Not equals | Yes | |
Less than or equals | Yes | |
Greater than or equals | No | |
Is missing | is missing | Yes |
Contains | contains | No |
Does not contains | does not contain | Yes |
Begins with | begins with | No |
To help remember whether character missing values match the query, think of the character missing value as being a zero-length string that contain no characters. Table 4.2 is consistent with the WHERE clause in the SAS DATA step.
As a first example, Figure 4.11 shows how to find observations in the Hurricanes data set whose latitude variable is contained in the interval . This is a quick way to find observations with latitudes between 28 and 32 in a single search.
A second example is shown in Figure 4.12. This search finds observations for which the date variable strictly precedes 07AUG1988. Note that the date variable has a DATE9. informat, so you can use that informat to make it more convenient to input the contents of the Value field. (Without the informat, you would need to search for the value 10445, the SAS date value corresponding to 06AUG1988.) Note that the date variable is a numeric variable, even though the formatted values appear as text.
Figure 4.12: Searching for Dates
A related example is shown in Figure 4.13. This search finds all observations for which the date variable contains the text "AUG". Note that to perform this search you must check Apply format to each value during search. This forces the Find dialog box to apply the DATE9. format to the date variable, which means comparing strings (character data) instead of numbers (numeric data). You can then select Contains from the Operation list. Each formatted string is searched for the value "AUG".
Figure 4.13: Matching Text in a Formatted Variable
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.