Reading a SAS data set
refers to opening a SAS data set and bringing an observation into the program data
vector for processing.
Combining SAS data sets
refers to reading data from two or more SAS data sets and processing them by
• concatenating
• interleaving
• one-to-one reading
• one-to-one merging
• match-merging
• updating a master data set with a transaction data set
The methods for combining SAS data sets are defined in “Combining SAS Data
Sets: Methods” on page 478.
Modifying SAS data sets
refers to using the MODIFY statement to update information in a SAS data set in
place. The MODIFY statement can save disk space because it modifies data in place,
without creating a copy of the data set. You can modify a SAS data set with
programming statements or with information that is stored in another data set.
Overview of Tools
The primary tools that are used for reading, combining, and modifying SAS data sets are
four statements: SET, MERGE, MODIFY, and UPDATE. This section describes these
tools and shows examples. For complete information about these statements, see the SAS
Statements: Reference.
Reading SAS Data Sets
Reading a Single SAS Data Set
To read data from an existing SAS data set, use a SET statement. In this example, the
DATA step creates data set Perm.Tour155_PeakCost by reading data from data set
Perm.Tour155_Basic_Cost and by calculating values for the three new variables
Total_Cost, Peak_Cost, and Average_Night_Cost.
data perm.tour155_peakcost;
set perm.tour155_basic_cost;
Total_Cost=AirCost+LandCost;
Peak_Cost=(AirCost*1.15);
Average_Night_Cost=LandCost/Nights;
run;
466 Chapter 21 • Reading, Combining, and Modifying SAS Data Sets