Techniques for Exploring Data


Subsetting Data

This section describes how to copy selected observations or variables to a new data table. The new data table is not dynamically linked to the original data. The original data are not changed.

You can copy selected data by selecting FileNewData Set from Selected Data from the main menu, as shown in Figure 11.1.

Figure 11.1: Creating a New Data Table from Selected Data

Creating a New Data Table from Selected Data


When you select FileNewData Set from Selected Data, SAS/IML Studio performs one of the following actions:

  • If no variables or observations are selected, the Choose Variables dialog box opens and prompts you to select one or more variables. (See Figure 11.2.) When you click OK, the selected variables are copied to a new data table. The variables are copied in the order in which they appear in the original data table.

    Figure 11.2: The Choose Variables Dialog Box

    The Choose Variables Dialog Box


  • If no variables are selected, but there are selected observations, the selected observations (for all variables) are copied to a new data table. You can use this technique to copy data that satisfy certain conditions.

  • If variables are selected, but there are no selected observations, the selected variables are copied to a new data table. The variables are copied in the order in which they were selected. You can use this technique to reorder variables.

  • If both variables and observations are selected, the selected observations for the selected variables are copied to a new data table. The variables are copied in the order in which they were selected. For example, in Figure 11.3 the variables were selected in the order longitude, latitude, and category. (Note that the column headings display numbers that indicate the order in which you selected the variables.) If you copy the data to a new data table, the new data table contains 12 observations for the longitude, latitude, and category variables, in that order.

Figure 11.3: Selected Variables and Observations

Selected Variables and Observations