Download presentation
Presentation is loading. Please wait.
Published byGladys Lawson Modified over 8 years ago
1
Beautiful PROC CONTENTS Output Using the ODS Excel Destination Suzanne Dorinski SESUG 2015 Disclaimer: Any views expressed are those of the author and not necessarily those of the U.S. Census Bureau.
2
Overview Question from in-house user group member Solution for Oracle database Solution for library with native SAS data sets 2
3
Question from user How do I export the output of PROC CONTENTS (variable name, type, length, and format) from several Oracle database tables within the same database to separate worksheets (one worksheet for each table) in an Excel spreadsheet? 3
4
ODS Excel destination! Easy to create native Excel output Experimental in SAS 9.4 M2 Production in SAS 9.4 M3 (July 2015 release) 4
5
Oracle database example 5
6
Connect to the Oracle database libname asj oracle user=asjview password=asjview path=jailprod.world schema=asjdba access=readonly; run; 6
7
Need to know which PROC CONTENTS output object to use 7
8
Save information to data set 8
9
Use _all_ keyword to work with all the data sets in a library 9
10
Sort for readability 10
11
PROC PRINT produces output 11
12
Add ODS sandwich options nobyline; ODS EXCEL FILE="H:\SESUG 2015\all_variables_from_Oracle_database.xlsx" options(sheet_name="#BYVAL(member)" embedded_titles='yes'); proc print data=AllOracleVarOut noobs; by member; pageby member; title "Variables in #BYVAL(member) table"; run; ODS EXCEL CLOSE; 12
13
View the output 13
14
Now do with library of SAS data sets ODS OUTPUT variables=allvarout; proc contents data=sashelp._all_ memtype=data; run; proc sort data=allvarout; by member num; run; 14
15
SAS data sets example continued options nobyline; ODS EXCEL FILE="H:\SESUG 2015\all_variables_in_SASHELP_data_sets.xlsx" options(sheet_name="#BYVAL(member)" embedded_titles='yes'); proc print data=allvarout noobs; by member; pageby member; title "Variables in #BYVAL(member) data set"; run; ODS EXCEL CLOSE; 15
16
View output for SASHELP library 16
17
SASHELP library varies based on products installed 185 data sets in SASHELP in Census Bureau’s virtual desktop infrastructure environment 86 data sets in SASHELP in SAS University Edition 17
18
Conclusions ODS Excel destination is easy to use Produces native Excel output Can quickly document all variables in SAS library 18
19
Questions? suzanne.marie.dorinski@census.gov 19
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.