|
Chapter Contents |
Previous |
Next |
| Working with SAS Data Sets |
Suppose you have updated data and want to change some values in the CLASS data set. For instance, suppose that the student named HENRY has had a birthday since the data were added to the CLASS data set. You can
First, submit an EDIT statement to make the CLASS data set current for input and output. Then use the FIND statement, which finds observation numbers and stores them in a matrix, to find the observation number of the data for HENRY and store it in the matrix d.
> edit class;
> find all where(name={'HENRY'}) into d;
> print d;
D
12
List the observation containing the data for HENRY.
> list point d;
OBS NAME SEX AGE HEIGHT WEIGHT
------ -------- -------- --------- --------- ---------
12 HENRY M 14.0000 63.5000 102.5000
As you see, the observation number is 12.
Now read the value for AGE into a matrix and update its value.
Finally, replace the value in the CLASS data set and
list the observation containing the data for HENRY again.
> age=15;
> replace;
1 observations replaced.
> list point 12;
OBS NAME SEX AGE HEIGHT WEIGHT
------ -------- -------- --------- --------- ---------
12 HENRY M 15.0000 63.5000 102.5000
|
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.