SYSTEM 2000 Data in SAS Programs |
Usually, you can treat view descriptors like SAS data files in SAS programs, however, here are some things you should consider. There are some circumstances when it is better to extract SYSTEM 2000 data and place it in a SAS data file rather than to read it directly. For example:
If you plan to use the same SYSTEM 2000 data in several procedures over a period of time, you might improve performance by extracting. SAS data files are organized to provide optimal performance with PROC and DATA steps. SAS programs using SAS data files often use less CPU time than when they read SYSTEM 2000 data directly.
If you plan to read large amounts of data from a large SYSTEM 2000 database and the database is being shared by several users (Multi-User mode), direct reading of the data could adversely affect all users' response time.
If you are the owner of a database, and you think that reading this data directly would present a security risk, you might want to extract the data and not distribute information about either the access descriptor or the view descriptor.
If you intend to use the data in a specific sorted order several times, it is usually best to run the SORT procedure on the view descriptor, and use the OUT= option. This is more efficient than requesting the same order of sorting repeatedly (with an ORDER BY clause) on the SYSTEM 2000 data. You cannot run PROC SORT on a view descriptor unless you use the OUT= option in the PROC SORT statement.
Sorting data can be resource-intensive, whether it is done with PROC SORT, with a BY statement (that generates an ordering-clause), or with an ordering-clause included in the view descriptor. You should sort data only when it is needed for your program.
If you reference a view descriptor in SAS code and the code includes a BY statement for a variable that corresponds to an item in the SYSTEM 2000 database, the interface view engine automatically generates an ordering-clause for that variable. The ordering-clause sorts the SYSTEM 2000 data before it uses the data in your SAS program. If the SYSTEM 2000 database is very large, this sorting can affect performance.
If the view descriptor already has an ordering-clause and you specify a BY statement in your SAS code, the BY statement overrides the view descriptor's ordering-clause. When you use a BY statement in SAS code with a view descriptor, it is most efficient to use a BY variable that is associated with an indexed SYSTEM 2000 item.
When writing SAS code and referencing a view descriptor, it is more efficient to use a WHERE statement in the code than it is to use a subsetting IF statement. The interface view engine passes the WHERE statement as a SYSTEM 2000 where-clause to the view descriptor, connecting it (using the Boolean operator AND) to any where-clause included in the view descriptor. (You can further optimize the selection criteria by using connecting strings. See Connecting Strings to Order Conditions.) Applying a WHERE clause to the SYSTEM 2000 data might reduce the number of entries processed, which often improves performance.
For more information, see Creating and Using View Descriptors Efficiently.
Copyright © 2007 by SAS Institute Inc., Cary, NC, USA. All rights reserved.