The example shows how to get PROC CONTENTS output into an ODS output
data set for processing.
title1 "PROC CONTENTS ODS Output";
options nodate nonumber nocenter formdlim='-';
data a;
x=1;
run;
|
ods output attributes=atr
variables=var
enginehost=eng;
|
|
ods listing close;
proc contents data=a;
run;
|
|
ods listing;
title2 "all Attributes data";
proc print data=atr noobs;
run;
title2 "all Variables data";
proc print data=var noobs;
run;
title2 "all EngineHost data";
proc print data=eng noobs;
run;
|
|
ods output attributes=atr1(keep=member cvalue1 label1
where=(attribute in ('Data Representation','Encoding'))
rename=(label1=attribute cvalue1=value))
attributes=atr2(keep=member cvalue2 label2
where=(attribute in ('Observations', 'Variables'))
rename=(label2=attribute cvalue2=value));
ods listing close;
proc contents data=a;
run;
ods listing;
data final;
set atr1 atr2;
run;
title2 "example of post-processing of ODS output data";
proc print data=final noobs;
run;
ods listing close; |
PROC CONTENTS ODS Output
------------------------------------------------------------------------------------------------------------------------------
PROC CONTENTS ODS Output
all Attributes data
c
Member Label1 cValue1 nValue1 Label2 Value2 nValue2
WORK.A Data Set Name WORK.A . Observations 1 1.000000
WORK.A Member Type DATA . Variables 1 1.000000
WORK.A Engine V9 . Indexes 0 0
WORK.A Created Thu, Feb 08, 2007 12:38:50 PM 1486557531 Observation Length 8 8.000000
WORK.A Last Modified Thu, Feb 08, 2007 12:38:50 PM 1486557531 Deleted Observations 0 0
WORK.A Protection . Compressed NO .
WORK.A Data Set Type . Sorted NO .
WORK.A Label . 0
WORK.A Data Representation WINDOWS_32 . 0
WORK.A Encoding wlatin1 Western (Windows) . 0
------------------------------------------------------------------------------------------------------------------------------
PROC CONTENTS ODS Output
all Variables data
Member Num Variable Type Len Pos
WORK.A 1 x Num 8 0
------------------------------------------------------------------------------------------------------------------------------
PROC CONTENTS ODS Output
all EngineHost data
Member Label1 cValue1 nValue1
WORK.A Data Set Page Size 4096 4096.000000
WORK.A Number of Data Set Pages 1 1.000000
WORK.A First Data Page 1 1.000000
WORK.A Max Obs per Page 501 501.000000
WORK.A Obs in First Data Page 1 1.000000
WORK.A Number of Data Set Repairs 0 0
WORK.A File Name C:\\a.sas7bdat .
WORK.A Release Created 9.0201B0 .
WORK.A Host Created XP_PRO .
------------------------------------------------------------------------------------------------------------------------------
PROC CONTENTS ODS Output
example of post-processing of ODS output data
Member attribute value
WORK.A Data Representation WINDOWS_32
WORK.A Encoding wlatin1 Western (Windows)
WORK.A Observations 1
WORK.A Variables 1
For more information, see
SAS Output Delivery System: User's Guide.
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.