Lesson 5, Part 2: Removing Formats and Informats from a SAS Dataset¶
In [4]:
* Ex24_remove_formats_informats.sas;
ods html close;
options nocenter nodate nonumber nosource;
title 'Metadata in sashelp.mdv';
proc contents data=sashelp.mdv varnum;
ods select position;
run;
The CONTENTS Procedure
| Variables in Creation Order | |||||
|---|---|---|---|---|---|
| # | Variable | Type | Len | Format | Informat |
| 1 | CODE | Char | 10 | ||
| 2 | ORIGCITY | Char | 8 | ||
| 3 | COUNTRY | Char | 14 | ||
| 4 | TYPE | Char | 14 | ||
| 5 | CITY | Char | 14 | ||
| 6 | COMPANY | Char | 50 | $30. | |
| 7 | SHIPDATE | Num | 8 | DATE7. | DATE. |
| 8 | SALES94 | Num | 8 | COMMA10.2 | |
| 9 | MONTH | Num | 8 | ||
| 10 | YEAR | Num | 8 | ||
| 11 | SALES93 | Num | 8 | COMMA10.2 | |
| 12 | SALES95 | Num | 8 | COMMA10.2 | |
| 13 | _4CAST96 | Num | 8 | COMMA10.2 | |
| 14 | DAY | Num | 8 | ||
In [5]:
data mdv;
set sashelp.mdv;
run;
proc datasets lib=work memtype=data nolist;
modify mdv;
attrib _all_ format=;
attrib _all_ informat=;
run;
quit;
title 'Metata data in new dataset called MDV';
title2 'After formats and informats removed from sashelp.mdv';
The SAS System NOTE: Writing HTML5(SASPY_INTERNAL) Body file: _TOMODS1 NOTE: There were 128 observations read from the data set SASHELP.MDV. NOTE: The data set WORK.MDV has 128 observations and 14 variables. NOTE: DATA statement used (Total process time): real time 0.02 seconds cpu time 0.00 seconds NOTE: MODIFY was successful for WORK.MDV.DATA. NOTE: PROCEDURE DATASETS used (Total process time): real time 0.04 seconds cpu time 0.00 seconds The SAS System E3969440A681A2408885998500000007
In [3]:
proc contents data=mdv varnum;
ods select position;
run;
title; title2;
The CONTENTS Procedure
| Variables in Creation Order | |||
|---|---|---|---|
| # | Variable | Type | Len |
| 1 | CODE | Char | 10 |
| 2 | ORIGCITY | Char | 8 |
| 3 | COUNTRY | Char | 14 |
| 4 | TYPE | Char | 14 |
| 5 | CITY | Char | 14 |
| 6 | COMPANY | Char | 50 |
| 7 | SHIPDATE | Num | 8 |
| 8 | SALES94 | Num | 8 |
| 9 | MONTH | Num | 8 |
| 10 | YEAR | Num | 8 |
| 11 | SALES93 | Num | 8 |
| 12 | SALES95 | Num | 8 |
| 13 | _4CAST96 | Num | 8 |
| 14 | DAY | Num | 8 |