Overview Section
We'll start this course by investigating something that you already know how to do well, namely reading SAS data sets. Well, that's not quite true — this lesson actually concerns a bit more than that. We will first review how to read data already contained in one SAS data set into another SAS data set. But then we'll explore the many ways in which a SAS data set can be modified. Some of the ways we will have seen before, such as changing a variable's attributes, while other ways will be new, such as using an accumulator variable to sum the contents of another variable. We'll then learn how to identify the first and last observations in a group, as well as the last observation in a data set. Then, we'll close out the lesson by discussing the process SAS follows when reading in a SAS data set.
Objectives
- use a SET statement to read data into a SAS data set from another SAS data set
- use an IF-THEN-DELETE statement to exclude observations from a SAS data set
- use a subsetting IF statement to include observations in a SAS data set
- use a DROP statement to reduce the number of variables in a SAS data set
- use a LABEL, FORMAT, or LENGTH statement to change the attributes of a variable
- create and use an accumulator variable
- use a SELECT statement to assign values to a variable conditionally
- use a SET and BY statement together in a DATA step in order to identify the first and last observations of a group and/or subgroup
- use FIRST.variables and LAST.variables in order to create new variables, modify the structure of a data set, etc.
- use the SET statement's END= option in order to identify the last observation in a SAS data set
- describe how SAS processes a DATA step when it involves using a SET statement to read from one SAS data set into another SAS data set