<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: PROC CONTENTS of entire library to seperate excel sheets in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-CONTENTS-of-entire-library-to-seperate-excel-sheets/m-p/562933#M157765</link>
    <description>&lt;P&gt;All I want is 3 tables per worksheet just as you would have in proc contents. Currently my code would output all 3 tables to&amp;nbsp; different sheets. I have about 30 datasets in a particular library and just trying to create a data dictionary for each dataset and output to a worksheet. So I will have 1 workbook that contains 30 sheets&lt;/P&gt;</description>
    <pubDate>Fri, 31 May 2019 17:31:56 GMT</pubDate>
    <dc:creator>OLUGBOJI</dc:creator>
    <dc:date>2019-05-31T17:31:56Z</dc:date>
    <item>
      <title>PROC CONTENTS of entire library to seperate excel sheets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-CONTENTS-of-entire-library-to-seperate-excel-sheets/m-p/562867#M157737</link>
      <description>&lt;P&gt;The code below only prints out the 'variable' ods object to the excel sheets. My question is how do I add two extra ODS objects&lt;BR /&gt;called 'attributes' and 'Enginehost' to get the full output of my proc contents to my excel sheets.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ODS OUTPUT variables=allvarout;&lt;/P&gt;&lt;P&gt;proc contents data=sashelp._all_ memtype=data;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;proc sort data=allvarout;&lt;BR /&gt;by member num;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;ODS EXCEL FILE="C:\my\outputfile.xlsx"&lt;BR /&gt;options(sheet_name="#BYVAL(member)"&lt;BR /&gt;embedded_titles='yes');&lt;BR /&gt;&lt;BR /&gt;proc print data=allvarout noobs;&lt;BR /&gt;by member;&lt;BR /&gt;pageby member;&lt;BR /&gt;title "Variables in #BYVAL(member) data set";&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;ODS EXCEL CLOSE;&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2019 14:46:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-CONTENTS-of-entire-library-to-seperate-excel-sheets/m-p/562867#M157737</guid>
      <dc:creator>OLUGBOJI</dc:creator>
      <dc:date>2019-05-31T14:46:12Z</dc:date>
    </item>
    <item>
      <title>Re: PROC CONTENTS of entire library to seperate excel sheets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-CONTENTS-of-entire-library-to-seperate-excel-sheets/m-p/562878#M157741</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/223111"&gt;@OLUGBOJI&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;The code below only prints out the 'variable' ods object to the excel sheets. My question is how do I add two extra ODS objects&lt;BR /&gt;called 'attributes' and 'Enginehost' to get the full output of my proc contents to my excel sheets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ODS OUTPUT variables=allvarout;&lt;/P&gt;
&lt;P&gt;proc contents data=sashelp._all_ memtype=data;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;proc sort data=allvarout;&lt;BR /&gt;by member num;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;ODS EXCEL FILE="C:\my\outputfile.xlsx"&lt;BR /&gt;options(sheet_name="#BYVAL(member)"&lt;BR /&gt;embedded_titles='yes');&lt;BR /&gt;&lt;BR /&gt;proc print data=allvarout noobs;&lt;BR /&gt;by member;&lt;BR /&gt;pageby member;&lt;BR /&gt;title "Variables in #BYVAL(member) data set";&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;ODS EXCEL CLOSE;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Add additional ODS OUTPUT for ATTRIBUTES and ENGINEHOST just as you have for Variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can find the tables to reference for ODS OUTPUT , SELECT or EXCLUDE using the ODS Trace instruction:&lt;/P&gt;
&lt;PRE&gt;ods trace on;
proc contents data=sashelp.class;
run;
ods trace off;&lt;/PRE&gt;
&lt;P&gt;Will generate the following output in the log:&lt;/P&gt;
&lt;PRE&gt;Output Added:
-------------
Name:       Attributes
Label:      Attributes
Template:   Base.Contents.Attributes
Path:       Contents.DataSet.Attributes
-------------

Output Added:
-------------
Name:       EngineHost
Label:      Engine/Host Information
Template:   Base.Contents.EngineHost
Path:       Contents.DataSet.EngineHost
-------------

Output Added:
-------------
Name:       Variables
Label:      Variables
Template:   Base.Contents.Variables
Path:       Contents.DataSet.Variables
-------------

Output Added:
-------------
Name:       Sortedby
Label:      Sortedby
Template:   Base.Contents.Sortedby
Path:       Contents.DataSet.Sortedby
-------------
&lt;/PRE&gt;
&lt;P&gt;The NAME shown in each block is the Table to reference for ODS OUTPUT, just as you did for VARIABLES.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2019 15:09:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-CONTENTS-of-entire-library-to-seperate-excel-sheets/m-p/562878#M157741</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-05-31T15:09:12Z</dc:date>
    </item>
    <item>
      <title>Re: PROC CONTENTS of entire library to seperate excel sheets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-CONTENTS-of-entire-library-to-seperate-excel-sheets/m-p/562903#M157750</link>
      <description>&lt;P&gt;Thanks. I already did that before I asked the question. The problem I have is getting the output to my worksheet&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2019 16:30:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-CONTENTS-of-entire-library-to-seperate-excel-sheets/m-p/562903#M157750</guid>
      <dc:creator>OLUGBOJI</dc:creator>
      <dc:date>2019-05-31T16:30:45Z</dc:date>
    </item>
    <item>
      <title>Re: PROC CONTENTS of entire library to seperate excel sheets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-CONTENTS-of-entire-library-to-seperate-excel-sheets/m-p/562923#M157759</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/223111"&gt;@OLUGBOJI&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thanks. I already did that before I asked the question. The problem I have is getting the output to my worksheet&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Since you did not show any code related to creating those data sets or reference them in the ODS destination how were we to know that you had actually done that?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now it may get interesting. Is your intent to have all three tables on one tab in excel for your "byvar'? Or to have the additional tables on different sheets by themselves?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Provide a dummy example of what you want with the output to be. Manual copy and paste into Excel of a few tables will show this. Then attach the Excel to a message in the forum.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a feeling that what you want is not difficult but may take a considerably different approach than you expect. But I am not going to attempt any example code until you can show what the desired output should actually look like.&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2019 17:09:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-CONTENTS-of-entire-library-to-seperate-excel-sheets/m-p/562923#M157759</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-05-31T17:09:47Z</dc:date>
    </item>
    <item>
      <title>Re: PROC CONTENTS of entire library to seperate excel sheets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-CONTENTS-of-entire-library-to-seperate-excel-sheets/m-p/562933#M157765</link>
      <description>&lt;P&gt;All I want is 3 tables per worksheet just as you would have in proc contents. Currently my code would output all 3 tables to&amp;nbsp; different sheets. I have about 30 datasets in a particular library and just trying to create a data dictionary for each dataset and output to a worksheet. So I will have 1 workbook that contains 30 sheets&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2019 17:31:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-CONTENTS-of-entire-library-to-seperate-excel-sheets/m-p/562933#M157765</guid>
      <dc:creator>OLUGBOJI</dc:creator>
      <dc:date>2019-05-31T17:31:56Z</dc:date>
    </item>
    <item>
      <title>Re: PROC CONTENTS of entire library to seperate excel sheets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-CONTENTS-of-entire-library-to-seperate-excel-sheets/m-p/563027#M157788</link>
      <description>&lt;P&gt;You might want to consider:&lt;/P&gt;
&lt;PRE&gt;ODS EXCEL FILE="C:\my\outputfile.xlsx"
   options (sheet_interval='PAGE')
&lt;BR /&gt;ods exclude directory;&lt;BR /&gt;ods exclude members;
proc contents data=sashelp._all_ memtype=data;
run;

ODS EXCEL CLOSE;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you insist on naming and providing titles then you will need to&lt;/P&gt;
&lt;P&gt;1) get a list of datasets&lt;/P&gt;
&lt;P&gt;2) set the sheet_name for each individual table&lt;/P&gt;
&lt;P&gt;3) set the title text for each proc contents call&lt;/P&gt;
&lt;P&gt;4) call proc contents&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The above can be done with CALL EXECUTE statements with the data set names in a control file or Macro coding.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why? The use of the #BY directives ONLY work with a single data set at a time with BY group processing for a single Proc. So you could not use simply by groups to get the desired output. Which will not allow you to have data from three different datasets within a single by group.&lt;/P&gt;</description>
      <pubDate>Fri, 31 May 2019 21:19:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-CONTENTS-of-entire-library-to-seperate-excel-sheets/m-p/563027#M157788</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-05-31T21:19:55Z</dc:date>
    </item>
  </channel>
</rss>

