SAS Data Management

SAS organizes data into a rectangular form or table that is called a SAS data set.
The following figure shows a SAS data set. The data describes participants in a
16-week weight program at a health and fitness club. The data for each participant
includes an identification number, name, team name, and weight (in U.S. pounds) at
the beginning and end of the program.


In a SAS data set, each row represents information about an individual entity and is
called an observation. Each column represents the same type of information and is
called a variable. Each separate piece of information is a data value. In a SAS data set, an observation contains all the data values for an entity; a variable contains the same
type of data value for all entities.

To build a SAS data set with Base SAS, you write a program that uses statements in
the SAS programming language. A SAS program that begins with a DATA statement
and typically creates a SAS data set or a report is called a DATA step.
The following SAS program creates a SAS data set named WEIGHT_CLUB from the
health club data:

data Weight

The following list corresponds to the numbered items in the preceding program:
u The DATA statement tells SAS to begin building a SAS data set named
v The INPUT statement identifies the fields to be read from the input data and
names the SAS variables to be created from them (IdNumber, Name, Team,
StartWeight, and EndWeight).
w The third statement is an assignment statement. It calculates the weight each
person lost and assigns the result to a new variable, Loss.
x The DATALINES statement indicates that data lines follow.
y The data lines follow the DATALINES statement. This approach to processing
raw data is useful when you have only a few lines of data. (Later sections show
ways to access larger amounts of data that are stored in files.)
U The semicolon signals the end of the raw data, and is a step boundary. It tells
SAS that the preceding statements are ready for execution.
Note: By default, the data set WEIGHT_CLUB is temporary; that is, it exists only
for the current job or session. For information about how to create a permanent SAS
data set, see Chapter 2, “Introduction to DATA Step Processing,”




2 thoughts on “SAS Data Management

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s