Chapter Contents

Previous

Next
The DATASETS Procedure

Example 3: Modifying SAS Data Sets


Procedure features:
PROC DATASETS statement option:
NOLIST
FORMAT statement
INDEX CREATE statement options:
NOMISS
UNIQUE
INFORMAT statement
LABEL statement
MODIFY statement options:
LABEL=
READ=
SORTEDBY=
RENAME statement

This example modifies two SAS data sets using the MODIFY statement and statements subordinate to it. Describing a SAS Data Set shows the modifications to the GROUP data set.

Tasks include


Program
 Note about code
options pagesize=40 linesize=80 nodate pageno=1 source;

libname health 'SAS-data-library';
 Note about code
proc datasets library=health nolist;


 Note about code
   modify group (label='Test Subjects' read=green sortedby=lname);


 Note about code
      index create vital=(birth salary) / nomiss unique;
 Note about code
      informat birth date7.;
      format birth date7.;

 Note about code
      label salary='current salary excluding bonus';
 Note about code
   modify oxygen;
      rename oxygen=intake;
      label intake='Intake Measurement';
quit;


SAS Log

1   options pagesize=40 linesize=80 nodate pageno=1 source;
2   
3   proc datasets library=health nolist;
4   
5      modify group (label='Test Subjects' read=XXXXX sortedby=lname);
WARNING: The file HEALTH.GROUP.DATA is not ALTER protected.  It could be 
         deleted or replaced without knowing the password.
6   
7         index create vital=(birth salary) / nomiss unique;
NOTE: Composite index vital has been defined.
8   
9         informat birth date7.;
10         format birth date7.;
11         label salary='current salary excluding bonus';
12   
13      modify oxygen;
14        rename oxygen=intake;
NOTE: Renaming variable oxygen to intake.
15        label intake='Intake Measurement';
16  quit;


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.