Once you understand the basics of establishing relationships among data and the ways you can combine SAS data sets, you can choose from a variety of SAS tools for accessing, combining, and processing your data. Table 1.1 lists and briefly describes the primary tools that are featured in this book. The remainder of the section describes in more detail some of the choices to make in determining how to combine and modify your data sets.
Class of Tool | Statement, PROC, or Other Tool | Action Performed | Sequential | Direct | Can Use with BY Statement | Comments |
---|---|---|---|---|---|---|
DATA Step Statements | SET | Reads an observation from one or more SAS data sets. | X | X | X | Use KEY = or POINT= to access data directly. |
MERGE | Reads observations from two or more SAS data sets and joins them into single observations. | X | X | When using MERGE with BY, the data must be sorted or indexed on the BY variable. | ||
MODIFY | Manipulates observations in a SAS data set in place | X | X | X | Sorted and indexed data are not required for direct access or usage with BY, but are recommended for performance. | |
UPDATE | Applies transactions to observations in a master SAS data set. UPDATE does not update observations in place; it produces an updated copy of the current data set. | X | X | Both the master and transaction data sets must be sorted or indexed on the BY variable. | ||
BY | Controls the operation of a SET, MERGE, UPDATE, or MODIFY statement in the DATA step and sets up special grouping variables. | N/A | N/A | N/A | BY-group processing is a means of processing observations that have the same values of one or more variables. | |
PROCs | PROC APPEND | Adds the observations from one SAS data set to the end of another SAS data set. | X | This procedure is limited to appending one data set to another. | ||
PROC DATASETS with APPEND Statement | Adds the observations from one SAS data set to the end of another SAS data set. | X | The APPEND statement in this procedure is limited to appending one data set to another. | |||
PROC SQL | Joins rows from one or more tables and can manipulate the rows in a table in place. The maximum number of tables that PROC SQL can read is 256. | X | X | The access method is chosen by the PROC SQL internal optimizer. | ||
Other | DATA Step Hash Objects | Enables you to quickly and efficiently store, search, and retrieve data based on lookup keys. Consists of two predefined component objects for use in the DATA step: the hash object and the hash iterator object. | N/A | N/A | N/A | Component objects are data elements that consist of attributes and methods. Attributes are the properties that specify the information that is associated with an object. Methods define the operations that an object can perform. |
_IORC_ | An automatic variable that is created when you use the MODIFY statement or when you use the SET statement with the KEY=option. | N/A | N/A | N/A | The value of this variable is a numeric return code that indicates the status of the most recent I/O operation that used MODIFY or KEY=. | |
%SYSRC | An autocall macro program that you use in conjunction with _IORC_ to test for specific I/O conditions. | N/A | N/A | N/A |
18.219.198.159