DATASETS Procedure
Example 1: Removing All Labels and Formats in a Data Set
Features: |
MODIFY statement option: ATTRIB
CONTENTS statement
|
Other features: |
PROC CONTENTS
|
Program
options ls=79 nodate nocenter;
title;
proc format;
value clsfmt 1='Freshman' 2='Sophmore' 3='Junior' 4='Senior';
run;
data class;
format z clsfmt.;
label x='ID NUMBER'
y='AGE'
z='CLASS STATUS';
input x y z;
datalines;
1 20 4
2 18 1
;
proc contents data=class;
run;
Program Description
The following example
deletes all labels and formats within a data set.
Set the following system options.
options ls=79 nodate nocenter;
title;
Create a user defined FORMAT with a value of CLSFMT.
proc format;
value clsfmt 1='Freshman' 2='Sophmore' 3='Junior' 4='Senior';
run;
Create a data set named CLASS. Use the CLSFMT format on variable Z. Create labels
for variables, X, Y, and Z.
data class;
format z clsfmt.;
label x='ID NUMBER'
y='AGE'
z='CLASS STATUS';
input x y z;
datalines;
1 20 4
2 18 1
;
Use PROC CONTENTS to view the contents of the data set
before removing the labels and format.
proc contents data=class;
run;
CONTENTS Procedure with Labels and Format
Within PROC DATASETS, remove all the labels and formats
using the MODIFY statement and the ATTRIB option.
proc datasets lib=work memtype=data;
modify class;
attrib _all_ label=' ';
attrib _all_ format=;
run;
Use the CONTENTS statement within PROC DATASETS to view
the contents of the data set without the labels and format.
contents data=class;
run;
quit;
CONTENTS Statement without Labels and Format
Copyright © SAS Institute Inc. All rights reserved.