Setting VIEWTABLE to show column names by default in SAS

By default in the DMS, Base SAS opens datasets from its Explorer using VIEWTABLE and with variable labels in the column headings and not variable names. Because I have been fortunate to use systems with SAS/FSP both installed and licensed, I have taken to using FSVIEW for browsing SAS datasets as a workaround and, though the interface may look old to some, it proves to be a very flexible tool that still has a few things to teach newer ones. With SAS Enterprise Guide, the dataset viewing functionality is different to both VIEWTABLE and FSVIEW but I have been to make it work for me. The SAS EG dataset viewing tool may appear like the former of these but it has a few tricks to teach its forbear.

 

 

Now that I find myself working again with the traditional SAS DMS interface and without SAS/FSP, I decided to see if there was a way to get VIEWTABLE to display variable names instead of variable labels by default. As it happened, the answer was found in an internet forum discussion. From the SAS command line, you can achieve the result issuing a command like the following:

 

 

VT SASHELP.VCOLUMN COLHEADING=NAMES

 

 

VT is the VIEWTABLE shortcut but it is the COLHEADING=NAMES option on the line that gets variable names shown in column headings. Taking it further, you can set this as the default setting for datasets opened using a mouse from Explorer panes using the following procedure:

 

 

  • Click in or on the Explorer pane to highlight the the Explorer window.

  • Select Tools->Options->Explorer in the menus.

  • Select the Members tab.

  • Double click on the TABLE icon.

  • Double click on the &Open action.

  • Set the Action command to:  VIEWTABLE %8b.’%s’.DATA COLHEADING=NAMES.

  • Click on the Set Default button.

  • Save changes and close the Explorer Options window.

 

 

 

Here is a solution by Richard DeVeneziawhich modifies the SAS registry with the SAS command RegEdit.

1) Type RegEdit in the command box (top left).

2) Choose Core

3) Choose Explorer

4) Choose Menus

5) Choose Members

6) Choose Table

7) Double click on default

8) Window pos up with    

        VIEWTABLE %8b.'%s'.DATA  

        Modify it to    

        VIEWTABLE %8b.'%s'.DATA; colnames

        Click OK

9) Close Regedit.

 

 

If you want to set it to the default setting, then you should use the first method since it has the "Set Default" button while the second method doesn't have one.(Still, you should mind the semicolon after 'DATA' is a slight difference between two ways.)

 

 

Because the DMS looks similar across versions 8.0 through to 9.2, the above instructions should be relevant to all of those. While I have yet to get the opportunity to use SAS 9.3, I would be surprised to find that the traditional SAS interface has changed there too, even though much else has changed about SAS. In fact, the latest version of SAS has brought quite a few new interesting features for programmers so it seems that you can do more through a familiar interface, not entirely a bad thing. It looks as if this VIEWTABLE tweak could be useful for a while yet.

posted @ 2013-12-12 16:32  寒秋绝月  阅读(384)  评论(0编辑  收藏  举报