Previous Page | Next Page

The DATASETS Procedure

Example 4: 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.

This example includes the following actions:


Program

 Note about code
options pagesize=40 linesize=80 nodate pageno=1 source;
LIBNAME health 'SAS-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

169  options pagesize=40 linesize=80 nodate pageno=1 source;
170  LIBNAME health 'c:\Documents and Settings\mydir\My
170! Documents\procdatasets\health';
NOTE: Libref HEALTH was successfully assigned as follows:
      Engine:        V9
      Physical Name: c:\Documents and Settings\mydir\My
      Documents\procdatasets\health

NOTE: PROCEDURE DATASETS used (Total process time):
      real time           8:06.11
      cpu time            0.54 seconds


171  proc datasets library=health nolist;
172   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.
173   index create vital=(birth salary) / nomiss unique;
NOTE: Composite index vital has been defined.
NOTE: MODIFY was successful for HEALTH.GROUP.DATA.
174  informat birth date7.;
175  format birth date7.;
176  label salary='current salary excluding bonus';
177  modify oxygen;
178  rename oxygen=intake;
NOTE: Renaming variable oxygen to intake.
179  label intake='Intake Measurement';
180  quit;

NOTE: MODIFY was successful for HEALTH.OXYGEN.DATA.
NOTE: PROCEDURE DATASETS used (Total process time):
      real time           15.09 seconds
      cpu time            0.06 seconds

Previous Page | Next Page | Top of Page