<?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 List datasets, variables, variable types and library name in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/List-datasets-variables-variable-types-and-library-name/m-p/549826#M74494</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm looking to list all datasets in a library, variables and variable types along with the library name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've found this on this forum located here:&lt;A href="https://communities.sas.com/t5/SAS-Procedures/PROC-CONTENTS-of-entire-library-with-all-variables-detail/td-p/19240" target="_blank"&gt;https://communities.sas.com/t5/SAS-Procedures/PROC-CONTENTS-of-entire-library-with-all-variables-detail/td-p/19240&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone please assist?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 10 Apr 2019 00:52:09 GMT</pubDate>
    <dc:creator>Haydn</dc:creator>
    <dc:date>2019-04-10T00:52:09Z</dc:date>
    <item>
      <title>List datasets, variables, variable types and library name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/List-datasets-variables-variable-types-and-library-name/m-p/549826#M74494</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm looking to list all datasets in a library, variables and variable types along with the library name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've found this on this forum located here:&lt;A href="https://communities.sas.com/t5/SAS-Procedures/PROC-CONTENTS-of-entire-library-with-all-variables-detail/td-p/19240" target="_blank"&gt;https://communities.sas.com/t5/SAS-Procedures/PROC-CONTENTS-of-entire-library-with-all-variables-detail/td-p/19240&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can someone please assist?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&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;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Apr 2019 00:52:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/List-datasets-variables-variable-types-and-library-name/m-p/549826#M74494</guid>
      <dc:creator>Haydn</dc:creator>
      <dc:date>2019-04-10T00:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: List datasets, variables, variable types and library name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/List-datasets-variables-variable-types-and-library-name/m-p/549827#M74495</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;* Change SASHELP with the library name;

PROC CONTENTS DATA=SASHELP._ALL_ ; RUN; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Apr 2019 01:20:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/List-datasets-variables-variable-types-and-library-name/m-p/549827#M74495</guid>
      <dc:creator>ghosh</dc:creator>
      <dc:date>2019-04-10T01:20:34Z</dc:date>
    </item>
    <item>
      <title>Re: List datasets, variables, variable types and library name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/List-datasets-variables-variable-types-and-library-name/m-p/549834#M74496</link>
      <description>&lt;P&gt;It all depends on what you want to do with it. If you want to do some coding then the proc sql is better. I'm doing an automatic metadata documentation of all the libraries, tables, variables and formats by a combination of queries to the dictionary tables. But if you only need to view them on off, then the proc datasets is perfect.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
	create table columns as
	select libname,	memname, name, type, length, varnum
	from dictionary.columns
	where libname = upcase('WORK') ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Apr 2019 03:44:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/List-datasets-variables-variable-types-and-library-name/m-p/549834#M74496</guid>
      <dc:creator>heffo</dc:creator>
      <dc:date>2019-04-10T03:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: List datasets, variables, variable types and library name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/List-datasets-variables-variable-types-and-library-name/m-p/550469#M74534</link>
      <description>Hi everyone, is there a way using either of the methods above or a macro, where I could specify the files I want, without getting all of them?</description>
      <pubDate>Thu, 11 Apr 2019 23:26:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/List-datasets-variables-variable-types-and-library-name/m-p/550469#M74534</guid>
      <dc:creator>Haydn</dc:creator>
      <dc:date>2019-04-11T23:26:39Z</dc:date>
    </item>
    <item>
      <title>Re: List datasets, variables, variable types and library name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/List-datasets-variables-variable-types-and-library-name/m-p/550472#M74535</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro printContents();

	proc sql noprint;
		*Get all the libraries that you want;
	  	select cats(libname,".",memname) into : ds separated by " " 
		from dictionary.tables
		where libname = upcase('SASHELP') and upcase(memname) in ("CLASS" "BASEBALL");
	quit;

	*Get the number of tables to loop.;
	%let no_of_tables=%sysfunc(countw(&amp;amp;ds," "));

	*Loop the list;
	%do _i = 1 %to &amp;amp;no_of_tables;
		%let ds_name=%scan(&amp;amp;ds,&amp;amp;_i, %str( ));
		PROC CONTENTS DATA=&amp;amp;ds_name; 
		RUN; 
	%end;
%mend printContents;

%printContents();&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Maybe this?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 23:37:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/List-datasets-variables-variable-types-and-library-name/m-p/550472#M74535</guid>
      <dc:creator>heffo</dc:creator>
      <dc:date>2019-04-11T23:37:14Z</dc:date>
    </item>
    <item>
      <title>Re: List datasets, variables, variable types and library name</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/List-datasets-variables-variable-types-and-library-name/m-p/550477#M74536</link>
      <description>Thanks heffo, it did the trick.</description>
      <pubDate>Thu, 11 Apr 2019 23:52:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/List-datasets-variables-variable-types-and-library-name/m-p/550477#M74536</guid>
      <dc:creator>Haydn</dc:creator>
      <dc:date>2019-04-11T23:52:43Z</dc:date>
    </item>
  </channel>
</rss>

