<?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 with all variables detail in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/PROC-CONTENTS-of-entire-library-with-all-variables-detail/m-p/19243#M3887</link>
    <description>&lt;P&gt;Another way is this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Note that value of libname is UPPERCASE */
proc sql;
create table columns as
select name as variable
,memname as table_name
from dictionary.columns
where libname = 'WORK'
;
quit;

/* SAS 9.4 or later */
ods excel file="c:\temp\variables.xlsx" style=minimal;
proc print data=columns;
run;
ods excel close;

/* earlier versions, using SAS/ACCESS to PC Files */
PROC EXPORT data = columns
OUTFILE = 'variables.xls' 
DBMS = EXCEL REPLACE;
SHEET='VARLIST'; 
RUN;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 24 Jan 2017 14:23:52 GMT</pubDate>
    <dc:creator>SASKiwi</dc:creator>
    <dc:date>2017-01-24T14:23:52Z</dc:date>
    <item>
      <title>PROC CONTENTS of entire library with all variables detail</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-CONTENTS-of-entire-library-with-all-variables-detail/m-p/19240#M3884</link>
      <description>I am trying to output my results of PROC CONTENTS for an entire library, to a SAS dataset. I want the details of each variable and the dataset it is located in.  Then export that dataset to Excel spreadsheet.&lt;BR /&gt;
I am using SAS 9.1.3 on WindowsXP Professional platform.&lt;BR /&gt;
&lt;BR /&gt;
I can't reach the person that did this before, but he got PROC CONTENTS to &lt;BR /&gt;
print variable name in first column followed by table name in second column, then attributes and other details in subsequent columns.  This allowed anyone to search for a variable and immediately find the table it is located in.&lt;BR /&gt;
&lt;BR /&gt;
Example of what I want the layout to look like:&lt;BR /&gt;
&lt;BR /&gt;
VARIABLE           TABLE NAME &lt;BR /&gt;
&lt;BR /&gt;
borrower_name      Customer&lt;BR /&gt;
address                 Customer&lt;BR /&gt;
account_num         Loan_Details&lt;BR /&gt;
loan_amount          Loan_Details&lt;BR /&gt;
interest_rate          Loan_Details</description>
      <pubDate>Wed, 22 Jun 2011 21:14:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-CONTENTS-of-entire-library-with-all-variables-detail/m-p/19240#M3884</guid>
      <dc:creator>chandler</dc:creator>
      <dc:date>2011-06-22T21:14:02Z</dc:date>
    </item>
    <item>
      <title>Re: PROC CONTENTS of entire library with all variables detail</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-CONTENTS-of-entire-library-with-all-variables-detail/m-p/19241#M3885</link>
      <description>Sorry, my first post was not clear.   I had to put "|" separaters in this message text to show column separation.  It wouldn't let me display spaces in tabular format.&lt;BR /&gt;
&lt;BR /&gt;
VARIABLE         |       TABLE_NAME I&lt;BR /&gt;
&lt;BR /&gt;
borrower_name    |      Customer        |&lt;BR /&gt;
address              |      Customer        |&lt;BR /&gt;
account_num      I      Loan_Details   |&lt;BR /&gt;
loan_amount       |      Loan_Details   |&lt;BR /&gt;
interest_rate       I       Loan_Details  |</description>
      <pubDate>Wed, 22 Jun 2011 21:24:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-CONTENTS-of-entire-library-with-all-variables-detail/m-p/19241#M3885</guid>
      <dc:creator>chandler</dc:creator>
      <dc:date>2011-06-22T21:24:45Z</dc:date>
    </item>
    <item>
      <title>Re: PROC CONTENTS of entire library with all variables detail</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-CONTENTS-of-entire-library-with-all-variables-detail/m-p/19242#M3886</link>
      <description>proc contents data= yourlib._all_ noprint out= a_data_set ; run;&lt;BR /&gt;
 &lt;BR /&gt;
ods tagsets.excelxp file= '!temp\contents.xml' ;&lt;BR /&gt;
proc print data= a_data_set noobs ;&lt;BR /&gt;
run ;&lt;BR /&gt;
ods tagsets.excelxp close ;&lt;BR /&gt;
  &lt;BR /&gt;
then open that file.&lt;BR /&gt;
If in a windows dialog box, just try&lt;BR /&gt;
%temp%\contents.xml&lt;BR /&gt;
If you run your code in SAS Display Manager, use SAS statement&lt;BR /&gt;
dm 'winexecfile "!temp\contents.xml" ' ;</description>
      <pubDate>Wed, 22 Jun 2011 21:49:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-CONTENTS-of-entire-library-with-all-variables-detail/m-p/19242#M3886</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2011-06-22T21:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: PROC CONTENTS of entire library with all variables detail</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-CONTENTS-of-entire-library-with-all-variables-detail/m-p/19243#M3887</link>
      <description>&lt;P&gt;Another way is this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Note that value of libname is UPPERCASE */
proc sql;
create table columns as
select name as variable
,memname as table_name
from dictionary.columns
where libname = 'WORK'
;
quit;

/* SAS 9.4 or later */
ods excel file="c:\temp\variables.xlsx" style=minimal;
proc print data=columns;
run;
ods excel close;

/* earlier versions, using SAS/ACCESS to PC Files */
PROC EXPORT data = columns
OUTFILE = 'variables.xls' 
DBMS = EXCEL REPLACE;
SHEET='VARLIST'; 
RUN;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 24 Jan 2017 14:23:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-CONTENTS-of-entire-library-with-all-variables-detail/m-p/19243#M3887</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2017-01-24T14:23:52Z</dc:date>
    </item>
    <item>
      <title>Re: PROC CONTENTS of entire library with all variables detail</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-CONTENTS-of-entire-library-with-all-variables-detail/m-p/242401#M55808</link>
      <description>This works the best, I ignored the Proc Export statement. Also important that you pay attention to the case of the libname - in this example it is capitalized and that is the only way it worked for me.</description>
      <pubDate>Fri, 08 Jan 2016 16:30:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-CONTENTS-of-entire-library-with-all-variables-detail/m-p/242401#M55808</guid>
      <dc:creator>AlexLab</dc:creator>
      <dc:date>2016-01-08T16:30:01Z</dc:date>
    </item>
  </channel>
</rss>

