Previous Page | Next Page

Managing Your Data in the SAS Windowing Environment

Subsetting Data by Using the WHERE Expression


Subset Rows of a Table

In the VIEWTABLE window, you can subset the display to show only those rows that meet one or more conditions. To subset rows of a table, follow these steps:

  1. In the Explorer window, open a library and double-click the table that you want to subset.

    In this example, the Furniture sales data table is selected.

    [untitled graphic]

  2. Right-click any table cell that is not a heading and select Where from the menu.

    The WHERE EXPRESSION window opens.

    [untitled graphic]

  3. In the Available Columns list, select a column, and then select an operator from the Operators menu.

    In this example, COUNTRY is selected from the Available Columns list, and EQ (equal to) is selected from the Operators menu. Note that the WHERE expression is being built in the Where box at the bottom of the window.

    [untitled graphic]

  4. In the Available Columns list, select another value to complete the WHERE expression.

    In this example, <LOOKUP distinct values> is selected.

  5. In the Lookup Distinct Values window that appears, select a value.

    In this example, Canada is selected.

    [untitled graphic]

    Note that the complete WHERE expression appears in the Where box at the bottom of the window.

    [untitled graphic]

  6. Click OK to close the WHERE EXPRESSION window.

    In this example, VIEWTABLE displays only rows where the value of Country is Canada.

    [untitled graphic]


Clear the WHERE Expression

You can clear the WHERE expression that you used to subset your data, and redisplay all of the data in the table. To do this, follow these steps:

  1. Right-click anywhere in the table except in a column heading.

  2. Select WHERE Clear from the pop-up menu.

    The VIEWTABLE window removes any existing subsets of data that were created with the WHERE expression, and displays all of the rows of the table.

Previous Page | Next Page | Top of Page