<?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: To print all datasets in a library in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/To-print-all-datasets-in-a-library/m-p/39519#M5464</link>
    <description>Sugest you run your code with the following SAS statement to get the most diagnostic info generated for self-checking:&lt;BR /&gt;
&lt;BR /&gt;
OPTIONS SOURCE SOURCE2 MACROGEN MPRINT;&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
    <pubDate>Tue, 12 Jan 2010 15:14:30 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2010-01-12T15:14:30Z</dc:date>
    <item>
      <title>To print all datasets in a library</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/To-print-all-datasets-in-a-library/m-p/39518#M5463</link>
      <description>I am using the following macro to print all the datasets ina library to single RTF file. However only the last available dataset is being printed in the RTF. Can any one suggest any modifications so that all the datasets are printed.&lt;BR /&gt;
&lt;BR /&gt;
  %macro printall(libname); &lt;BR /&gt;
     %local num i; &lt;BR /&gt;
     proc datasets library=&amp;amp;libname memtype=data nodetails;&lt;BR /&gt;
      contents out=temp1(keep=memname) data=_all_ noprint;&lt;BR /&gt;
   run; &lt;BR /&gt;
     data _null_;&lt;BR /&gt;
      set temp1 end=final;&lt;BR /&gt;
      by memname notsorted;&lt;BR /&gt;
      if last.memname;&lt;BR /&gt;
      n+1;&lt;BR /&gt;
      call symput('ds'||left(put(n,8.)),trim(memname)); &lt;BR /&gt;
        if final then call symput('num',put(n,8.)); &lt;BR /&gt;
     run; &lt;BR /&gt;
     %do i=1 %to &amp;amp;num;&lt;BR /&gt;
	 &lt;BR /&gt;
    ODS Listing Close;&lt;BR /&gt;
	 ods rtf nogtitle file="C:\report1.rtf" style=profile ;&lt;BR /&gt;
	 &lt;BR /&gt;
		proc print data=&amp;amp;libname..&amp;amp;&amp;amp;ds&amp;amp;i noobs;&lt;BR /&gt;
    run;&lt;BR /&gt;
    ods rtf close;&lt;BR /&gt;
&lt;BR /&gt;
   %end;&lt;BR /&gt;
%mend printall;&lt;BR /&gt;
&lt;BR /&gt;
thanks in advance</description>
      <pubDate>Tue, 12 Jan 2010 14:52:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/To-print-all-datasets-in-a-library/m-p/39518#M5463</guid>
      <dc:creator>madhu</dc:creator>
      <dc:date>2010-01-12T14:52:33Z</dc:date>
    </item>
    <item>
      <title>Re: To print all datasets in a library</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/To-print-all-datasets-in-a-library/m-p/39519#M5464</link>
      <description>Sugest you run your code with the following SAS statement to get the most diagnostic info generated for self-checking:&lt;BR /&gt;
&lt;BR /&gt;
OPTIONS SOURCE SOURCE2 MACROGEN MPRINT;&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Tue, 12 Jan 2010 15:14:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/To-print-all-datasets-in-a-library/m-p/39519#M5464</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-01-12T15:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: To print all datasets in a library</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/To-print-all-datasets-in-a-library/m-p/39520#M5465</link>
      <description>The log generated by using the above mentioned options or without using the above mentioned options is clear from any warnings or errors. The problem here is once the second dataset is printed the first dataset is being replaced. I want to avoid such a replacement.&lt;BR /&gt;
&lt;BR /&gt;
Thanks.</description>
      <pubDate>Tue, 12 Jan 2010 15:42:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/To-print-all-datasets-in-a-library/m-p/39520#M5465</guid>
      <dc:creator>madhu</dc:creator>
      <dc:date>2010-01-12T15:42:39Z</dc:date>
    </item>
    <item>
      <title>Re: To print all datasets in a library</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/To-print-all-datasets-in-a-library/m-p/39521#M5466</link>
      <description>Suggest moving your ODS commands (plural) to be outside your %DO %END loop, which is causing the reported condition, I believe.

Message was edited by: sbb</description>
      <pubDate>Tue, 12 Jan 2010 16:17:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/To-print-all-datasets-in-a-library/m-p/39521#M5466</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-01-12T16:17:32Z</dc:date>
    </item>
    <item>
      <title>Re: To print all datasets in a library</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/To-print-all-datasets-in-a-library/m-p/39522#M5467</link>
      <description>All you need to do is move the ODS statement outside the %DO I=1 loop so that the file remains open for all the PROC PRINTs.  Then CLOSE it after you have written everything you want to it.</description>
      <pubDate>Tue, 12 Jan 2010 16:21:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/To-print-all-datasets-in-a-library/m-p/39522#M5467</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-01-12T16:21:07Z</dc:date>
    </item>
    <item>
      <title>Re: To print all datasets in a library</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/To-print-all-datasets-in-a-library/m-p/39523#M5468</link>
      <description>All you need to do is move the ODS statement outside the %DO I=1 loop so that the file remains open for all the PROC PRINTs.  Then CLOSE it after you have written everything you want to it.</description>
      <pubDate>Tue, 12 Jan 2010 16:21:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/To-print-all-datasets-in-a-library/m-p/39523#M5468</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-01-12T16:21:28Z</dc:date>
    </item>
    <item>
      <title>Re: To print all datasets in a library</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/To-print-all-datasets-in-a-library/m-p/39524#M5469</link>
      <description>One of my favorite interview questions back when I did a lot of hiring.  You don't even need a macro.  The ODS steps could be outside the data _null_ &lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
set sashelp.vmember( where = (libname = upcase('&amp;amp;libname') and memtype = 'DATA')) end = eof;&lt;BR /&gt;
if _n_ = 1 then call execute("ODS Listing Close; ods rtf nogtitle file='C:\report1.rtf' style=profile ;");&lt;BR /&gt;
call execute("proc print data = " || memname || " noobs; run;");&lt;BR /&gt;
if EOF then call execute("ods rtf close;");&lt;BR /&gt;
run;</description>
      <pubDate>Wed, 13 Jan 2010 13:57:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/To-print-all-datasets-in-a-library/m-p/39524#M5469</guid>
      <dc:creator>Flip</dc:creator>
      <dc:date>2010-01-13T13:57:47Z</dc:date>
    </item>
  </channel>
</rss>

