O'Reilly logo

SAS 9.4 Language Reference, 6th Edition by SAS Institute

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to View DICTIONARY Tables
About Dictionary Tables
You might want to view the contents of DICTIONARY tables in order to see information
about your current SAS session, before actually using the table in a DATA step or a SAS
procedure.
Some DICTIONARY tables can become quite large. In this case, you might want to
view a part of a DICTIONARY table that contains only the data that you are interested
in. The best way to view part of a DICTIONARY table is to subset the table using a
PROC SQL WHERE clause.
How to View a DICTIONARY Table
Each DICTIONARY table has an associated PROC SQL view in the Sashelp library.
You can see the entire contents of a DICTIONARY table by opening its Sashelp view
with the VIEWTABLE or FSVIEW utilities. This method provides more detail than you
receive in the output of the DESCRIBE TABLE statement, as shown in “How to View a
Summary of a DICTIONARY Table” on page 690.
The following steps describe how to use the VIEWTABLE or FSVIEW utilities to view
a DICTIONARY table in a windowing environment.
1. Invoke the Explorer window in your SAS session.
2. Select the Sashelp library. A list of members in the Sashelp library appears.
3. Select a SAS view with a name that starts with V (for example, VMEMBER).
A VIEWTABLE window appears that contains its contents. (For z/OS, type the letter
'O' in the command field for the desired member and press Enter. The FSVIEW
window appears with the contents of the view.)
In the VIEWTABLE window the column headings are labels. To see the column names,
select View ð Column Names.
How to View a Summary of a DICTIONARY Table
The DESCRIBE TABLE statement in PROC SQL produces a summary of the contents
of a DICTIONARY table. The following example uses the DESCRIBE TABLE
statement in order to generate a summary for the table DICTIONARY.INDEXES. (The
Sashelp view for this table is Sashelp.VINDEX).
proc sql;
describe table dictionary.indexes;
The result of the DESCRIBE TABLE statement appears in the SAS log:
NOTE: SQL table DICTIONARY.INDEXES was created like:
create table DICTIONARY.INDEXES
(
libname char(8) label='Library Name',
memname char(32) label='Member Name',
690 Chapter 29 DICTIONARY Tables
memtype char(8) label='Member Type',
name char(32) label='Column Name',
idxusage char(9) label='Column Index Type',
indxname char(32) label='Index Name',
indxpos num label='Position of Column in Concatenated Key',
nomiss char(3) label='Nomiss Option',
unique char(3) label='Unique Option
);
The first word on each line is the column (or variable) name. You need to use this
name when you write a SAS statement that refers to the column (or variable).
Following the column name is the specification for the type of variable and the width
of the column.
The name that follows label= is the column (or variable) label.
After you know how a table is defined, you can use the processing ability of the PROC
SQL WHERE clause in a PROC SQL step to extract a portion of a SAS view.
How to View a Subset of a DICTIONARY Table
When you know that you are accessing a large DICTIONARY and you need to use only
a portion of it, use a PROC SQL WHERE clause in order to extract a subset of the
original. The following PROC SQL statement demonstrates the use of a PROC SQL
WHERE clause in order to extract lines from DICTIONARY.INDEXES.
proc sql;
title 'Subset of the DICTIONARY.INDEX View';
title2 'Rows with Column Name equal to STATE';
select libname, memname, name
from dictionary.indexes
where name = 'STATE';
quit;
The results are shown in the following output:
How to View DICTIONARY Tables 691

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required