Procedure features: |
PROC
DATASETS statement option:
|
FORMAT statement |
INDEX CREATE statement options:
|
INFORMAT statement |
LABEL
statement |
MODIFY statement options:
|
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:
-
modifying SAS files
-
labeling a SAS data set
-
adding a READ password to a SAS data
set
-
indicating how a SAS data set is currently sorted
-
creating an index for a SAS data set
-
assigning informats and formats to
variables in a SAS data set
-
renaming variables in a SAS data set
-
labeling variables in a SAS data set
![Note about code](../../../../common/63294/HTML/default/images/snbut.gif) |
options pagesize=40 linesize=80 nodate pageno=1 source; |
LIBNAME health 'SAS-library';
![Note about code](../../../../common/63294/HTML/default/images/snbut.gif) |
proc datasets library=health nolist; |
![Note about code](../../../../common/63294/HTML/default/images/snbut.gif) |
modify group (label='Test Subjects' read=green sortedby=lname); |
![Note about code](../../../../common/63294/HTML/default/images/snbut.gif) |
index create vital=(birth salary) / nomiss unique; |
![Note about code](../../../../common/63294/HTML/default/images/snbut.gif) |
informat birth date7.;
format birth date7.; |
![Note about code](../../../../common/63294/HTML/default/images/snbut.gif) |
label salary='current salary excluding bonus'; |
![Note about code](../../../../common/63294/HTML/default/images/snbut.gif) |
modify oxygen;
rename oxygen=intake;
label intake='Intake Measurement';
quit; |
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
![](../../../../common/63294/HTML/default/images/spacer.gif) |
![](../../../../common/63294/HTML/default/images/spacer.gif) |
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.