<?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: How to use proc append in an iterative way in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-use-proc-append-in-an-iterative-way/m-p/155419#M12134</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's one way;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First, I'd put "proc sql; drop table want; quit;" right after "%macro test;". It's not required as long as you remember to delete your append dataset after each test, but I ALWAYS forget!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, inside the loop, in place of your proc print and ODS statements, try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc append base=want data=tablename(where=(col1 ="&amp;amp;x"));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and then your proc print and ODS statements can go after your %end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 12 May 2014 19:21:10 GMT</pubDate>
    <dc:creator>TomKari</dc:creator>
    <dc:date>2014-05-12T19:21:10Z</dc:date>
    <item>
      <title>How to use proc append in an iterative way</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-use-proc-append-in-an-iterative-way/m-p/155416#M12131</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I currently have this SAS program:&lt;/P&gt;&lt;P&gt;%let i = 1;&lt;/P&gt;&lt;P&gt;%macro test;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %let x = %scan(&amp;amp;idlist,&amp;amp;i,'*');&lt;/P&gt;&lt;P&gt;%do %until (&amp;amp;x= );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%put "&amp;amp;x";&lt;/P&gt;&lt;P&gt;ods html file="/sasdata//temp&amp;amp;x .xls" headtext="&amp;lt;style&amp;gt;&lt;/P&gt;&lt;P&gt;td {mso-number-format:\@}&amp;lt;/style&amp;gt;";&lt;/P&gt;&lt;P&gt;proc print data=libanme.tablename uniform label;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var col1 col2 col3 col4 col5;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where col1&amp;nbsp; ="&amp;amp;x";&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ods html close;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %put "&amp;amp;x";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let i = &amp;amp;i +1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let x = %scan(&amp;amp;idlist,&amp;amp;i,'*');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%mend test;&lt;/P&gt;&lt;P&gt;%test;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This program creates a separate xls file in each iteration.&lt;/P&gt;&lt;P&gt;My objective is to create a single dataset and append result of each iteration to that dataset and create a single output xls file containing the entire dataset.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 May 2014 16:55:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-use-proc-append-in-an-iterative-way/m-p/155416#M12131</guid>
      <dc:creator>eagles_dare13</dc:creator>
      <dc:date>2014-05-12T16:55:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to use proc append in an iterative way</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-use-proc-append-in-an-iterative-way/m-p/155417#M12132</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not quite clear on what you're trying to do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It looks to me like each xls file contains the result of your "where" clause. To contain the entire dataset, wouldn't you just remove the "where" clause?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 May 2014 17:17:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-use-proc-append-in-an-iterative-way/m-p/155417#M12132</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2014-05-12T17:17:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to use proc append in an iterative way</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-use-proc-append-in-an-iterative-way/m-p/155418#M12133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks. What I want is that each iteration would contain a result of the where clause and append this result to a master data set. And then output this dataset in form of xls.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So if the table contains 1 million records and each iteration contains 5 records as per the where clause and if there are 5 iterations, then i want a single dataset created with the 5 * 5 = 25 records. And then output this dataset in xls.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 May 2014 17:21:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-use-proc-append-in-an-iterative-way/m-p/155418#M12133</guid>
      <dc:creator>eagles_dare13</dc:creator>
      <dc:date>2014-05-12T17:21:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to use proc append in an iterative way</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-use-proc-append-in-an-iterative-way/m-p/155419#M12134</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's one way;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First, I'd put "proc sql; drop table want; quit;" right after "%macro test;". It's not required as long as you remember to delete your append dataset after each test, but I ALWAYS forget!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, inside the loop, in place of your proc print and ODS statements, try:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc append base=want data=tablename(where=(col1 ="&amp;amp;x"));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and then your proc print and ODS statements can go after your %end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tom&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 May 2014 19:21:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-use-proc-append-in-an-iterative-way/m-p/155419#M12134</guid>
      <dc:creator>TomKari</dc:creator>
      <dc:date>2014-05-12T19:21:10Z</dc:date>
    </item>
  </channel>
</rss>

