Previous Page | Next Page

Managing Your Data in the SAS Windowing Environment

Working with VIEWTABLE


Overview of VIEWTABLE

To manipulate data interactively, you can use SAS software's table editor, the VIEWTABLE window. In the VIEWTABLE window, you can create a new table, and browse or edit an existing table.


View the Contents of a SAS Data Set

To view the contents of a data set with VIEWTABLE, follow these steps:

  1. Open SAS Explorer and select a library.

    The contents of the library displays.

  2. Double-click a data set within the library.

    The VIEWTABLE window appears and is populated with data from the data set:

    [untitled graphic]

  3. Scroll the VIEWTABLE window to view all of the data in your data set.


Move Columns in a Table

Within the VIEWTABLE window, you can rearrange columns in your table. To move columns in your table,

  1. Left-click a column heading for the column you want to move.

  2. Drag and drop the heading onto another column heading. In this example, if you left-click the heading Product Type, and then drag and drop Product Type onto Country, the Product Type column moves to the right of the Country column.

    [untitled graphic]


Temporarily Change Column Headings

Within the VIEWTABLE window, you can temporarily change column headings. To temporarily change column headings, follow these steps:

  1. Right-click the heading for the column that you want to change, and then select Column Attributes from the menu. In this example, the column heading Country is listed in the Name field of the Column Attributes window.

    [untitled graphic]

  2. In the Label field of the Column Attributes window, type the new name of the column heading and then click Apply.

    The column heading in VIEWTABLE changes to the new name. In this example the label was changed to Country of Origin.

    [untitled graphic]

  3. Click Close to close the Column Attributes window.


Sort by Values of a Column

You can sort your table in ascending or descending order, based on the values in a column. You can sort data permanently or create a sorted copy of your table.

To sort your table, follow these steps:

  1. Right-click the heading of the column on which you want to sort, and select Sort from the menu.

  2. Select Ascending or Descending from the menu.

  3. When the following warning message appears, click Yes to create a sorted copy of the table.

    [untitled graphic]

    Note:   If you selected Edit Mode after opening the table and clicking a data cell, this window does not appear. SAS updates the original table.   [cautionend]

  4. In the Sort window, type the name of the new sorted table. In this example, the name of the sorted table is FurnSalesSorted.

    [untitled graphic]

  5. Click OK.

    The rows in the new table are sorted in descending order by values of Actual Sales.

    [untitled graphic]


Edit Cell Values

By default, VIEWTABLE opens existing tables in browse mode, which protects the table data. To edit the table, you need to switch to edit mode. To switch to edit mode, follow these steps:

  1. With the table open, select Edit [arrow] Edit Mode from the Edit menu.

  2. Left-click a cell in the table, and the value in the cell is highlighted.

    In this example, the third cell in the fourth row is selected.

    [untitled graphic]

  3. Type a new value in the cell and press Enter.

    In this example, the cell has been updated with the value North Carolina.

    [untitled graphic]

  4. Select File [arrow] Close from the File menu.

  5. When prompted to save pending changes to the table, click Yes to save your changes or No to disregard changes.

Note:   If you make changes in one row and then edit cells in another row, the changes in the first row are automatically saved. When you select File [arrow] Close, you are prompted to save the pending changes to the second row.  [cautionend]

Previous Page | Next Page | Top of Page