The following window appears for the Air data set:
4. In the Description field of the General tab, you can enter a description of the data
set. To save the description, click OK.
5. Select other tabs to display additional information about the data set.
Working with VIEWTABLE
Overview of VIEWTABLE
To manipulate data interactively, you can use the SAS table editor, VIEWTABLE. In the
VIEWTABLE window, you can create a new table, and view or edit an existing table.
Opening a SAS Data Set in a VIEWTABLE Window
You can open an existing SAS data set in a VIEWTABLE window by double-clicking on
the SAS data set icon in the SAS Explorer window, or by specifying the VIEWTABLE
command in the SAS Display Manager command line. The following sections provide
details about using either of these two methods.
Using the SAS Explorer Window
Here are the steps for using the SAS Explorer window to open a SAS data set in a
VIEWTABLE window:
1. Open SAS Explorer and double-click on the icon for the library that contains the
target data set.
2. Select the desired data set and double-click on its icon.
382 Chapter 17 Managing Your Data in the SAS Windowing Environment
3. The VIEWTABLE window should appear, populated with data from the data set.
4. Use the scroll bar on the VIEWTABLE window to view all of the data.
Using the VIEWTABLE Command
You can also open a data set in a VIEWTABLE window by using the VIEWTABLE
command in the SAS Display Manager command line.
1. Specify the VIEWTABLE command in the SAS Display Manager command line
using the following syntax:
VIEWTABLE data-set-name <-options>
2. Here is an example:
viewtable cars
Working with VIEWTABLE 383
Displaying Table Headers as Names or Labels
When you open a data set that contains labels in a VIEWTABLE window, SAS
automatically displays the table headers as variable labels rather than the variable names.
You can change the way SAS displays table headers by using the VIEWTABLE pop-up
menu or by using the VIEWTABLE command.
Using the VIEWTABLE pop-up menu to change the way table headers are
displayed:
1. Open a data set in VIEWTABLE (to access the VIEWTABLE pop-up menu, you
must have an active VIEWTABLE window open).
2. Make sure that the VIEWTABLE window is active.
3. Select View ð Column Names or View ð Column Labels from the drop-down
View menu.
4. Once this selection is made, the opened table, and all tables that are subsequently
opened, will display table headers based on this setting in the VIEWTABLE pop-
up menu. When you exit VIEWTABLE, or exit SAS, the preference for column
labels or column names is saved. When you open VIEWTABLE or invoke SAS
again, the preference that you chose is automatically selected.
This feature is available in SAS 9.4M1 and later releases.
Using the VIEWTABLE command to change the way table headers are displayed
when a table is opened:
1. Specify the COLHEADING= option on the VIEWTABLE command in the SAS
command line using the following syntax.
VIEWTABLE data-set-name -<COLHEADING>=NAMES | LABELS>
2. Here is an example:
viewtable cars colheading=names
384 Chapter 17 Managing Your Data in the SAS Windowing Environment
Customizing SAS Explorer for Opening the VIEWTABLE Window
You can customize SAS Explorer to open a VIEWTABLE window so that column
headings are displayed as either names or labels every time that the table is opened from
the SAS Explorer window. To do this, add the COLHEADING= option to the Action
Command in the SAS Explorer Options dialog box.
1. With the SAS Explorer window active, select Tools ð Options ð Explorer to open
the Explorer Options window.
2. Select the Members tab.
3. Select Table in the list of registered types, and then click Edit to open the TABLE
Options dialog box.
4. Select the &Open Action Command in the list of actions, and then click Edit to
open the Edit Action dialog box.
5. In the Edit Action dialog box, add -COLHEADING=<value> to the end of the
VIEWTABLE command:
VIEWTABLE %8b.'%s'.DATA colheading=names
Working with VIEWTABLE 385

Get SAS 9.4 Language Reference, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.