When you query a DICTIONARY table, SAS gathers information
that is pertinent to that table. Depending on the DICTIONARY table
that is being queried, this process can include searching libraries,
opening tables, and executing SAS views. Unlike other SAS procedures
and the DATA step, PROC SQL can improve this process by optimizing
the query before the select process is launched. Therefore, although
it is possible to access DICTIONARY table information with SAS procedures
or the DATA step by using the SASHELP views, it is often more efficient
to use PROC SQL instead.
For example, the following
programs both produce the same result, but the PROC SQL step runs
much faster because the WHERE clause is processed before opening the
tables that are referenced by the SASHELP.VCOLUMN view:
data mytable;
set sashelp.vcolumn;
where libname='WORK' and memname='SALES';
run;
proc sql;
create table mytable as
select * from sashelp.vcolumn
where libname='WORK' and memname='SALES';
quit;
Note: SAS does not maintain DICTIONARY
table information between queries. Each query of a DICTIONARY table
launches a new discovery process.
If you are querying
the same DICTIONARY table several times in a row, you can get even
faster performance by creating a temporary SAS data set (with the
DATA step SET statement or PROC SQL CREATE TABLE AS statement) with
the information that you desire and run your query against that data set.