The Variables Menu

You can access the Variables menu (shown in Figure 4.2) by clicking a column heading and selecting Edit Variables from the main menu. Alternatively, right-clicking a variable heading (see Figure 4.1) selects that variable and displays the same menu.

You can use the Variables menu to do the following:

  • change properties of existing variables

  • create a new variable

  • change the set of variables that are displayed in the data table

  • change the set of selected and unselected variables

  • set the role of an existing variable. You can assign three default roles:

    Label

    The values of the variable are used to label the markers in a plot. Only the markers that you have clicked are labeled.

    Frequency

    The values of the variable are used as the frequency of occurrence for each observation. If you assign a variable to a Frequency role, then that variable is automatically added to dialog boxes for analyses and graphs that support a frequency variable.

    Weight

    The values of the variable are used as weights for each observation. If you assign a variable to a Weight role, then that variable is automatically added to dialog boxes for analyses and graphs that support a weight variable.

All roles are optional; you do not need to specify any roles. A variable can play multiple roles, but there can be at most one variable assigned to each role.

Figure 4.2 The Variables Menu
The Variables Menu

The following list describes each item on the Variables menu.

Properties


displays the Variable Properties dialog box, described in the section Adding Variables in Chapter 3, Creating and Editing Data. The dialog box enables you to change most properties for the selected variable. However, you cannot change the type (character or numeric) of an existing variable.

Interval/Nominal


changes the measure level of the selected numeric variable. A character variable cannot be interval.

Label


makes the selected variable the label variable for plots. Only one variable can have this role.

Frequency


makes the selected variable the frequency variable for analyses and plots that support a frequency variable. Only a numeric variable can have a Frequency role.

Weight


makes the selected variable the weight variable for analyses and plots that support a weight variable. Only a numeric variable can have a Weight role.

Ordering


specifies how nominal variables are ordered. This affects the way that a variable is sorted and the order of categories in plots. If a variable has missing values, they are always ordered first. See the Ordering Categories of a Nominal Variable section in Chapter 11 for further details. The Ordering submenu is shown in Figure 4.3.

Figure 4.3 The Ordering Menu
The Ordering Menu

You can order a variable in the following ways:

Standard

specifies that categories be arranged in ASCII order by their unformatted values. In ASCII order, numerals precede uppercase letters, which precede lowercase letters.

by Frequency

specifies that categories be arranged according to the descending frequency count of formatted values in each category.

by Format

specifies that categories be arranged in ASCII order by their formatted values.

by Data

specifies that categories be arranged according to the data order of formatted values. The data order is determined by traversing the values of a variable, starting from the first observation. The first (nonmissing) value you encounter is ordered first, the next unique (nonmissing) value of the variable is ordered second, and so on. Sorting the data table does not affect this ordering; the ordering is based on the original sequence of observations.

by Frequency (unformatted)

specifies that categories be arranged according to the descending frequency count of unformatted values in each category.

by Data (unformatted)

specifies that categories be arranged according to the data order of unformatted values. Sorting the data table does not affect this ordering; the ordering is based on the original sequence of observations.

Custom

specifies that this variable be ordered by calling the DataObject.SetVarValueOrder method. See the SAS/IML Studio online Help for details about this method.

Sort


displays the Sort dialog box. The Sort dialog box is described in the section Sorting Observations.

New Variable


displays the New Variable dialog box to create a new variable as described in the section Adding Variables in Chapter 3, Creating and Editing Data. (See Figure 3.5.)

Delete


deletes the selected variables.

Display Name/Display Label


toggles whether the column heading displays the names of variables or displays their labels.

Hide


hides the selected variables. The variables can be displayed at a later time by selecting Show All. Hidden variables cannot be selected.

Show All


displays all variables, including variables that were hidden.

Invert Selection


changes the set of selected variables. Deselected variables become selected, and selected variables become deselected.

Generate _OBSTAT_ Variable


creates a new character variable called _OBSTAT_ that encodes the current state of each observation. The values of the _OBSTAT_ variable are described in the next section.