<?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: clear results/outputs generated by procedures within macro in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/clear-results-outputs-generated-by-procedures-within-macro/m-p/591718#M15256</link>
    <description>&lt;P&gt;First thing would be to provide a more detailed description and possibly use different data set names in the example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You only actually show one data set inside the macro, repeating the name of one outside, and it is not clear what you want to keep.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Typically I would use proc datasets to delete any datasets that I don't want. Either at the beginning of a macro to prevent reuse of an existing set or at the end of the macro to clean up before it ends.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The syntax is&lt;/P&gt;
&lt;P&gt;Proc datasets library=somelib;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; delete datasetname;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you may want the NOPRINT option to reduce any output in the log&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 25 Sep 2019 21:42:29 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-09-25T21:42:29Z</dc:date>
    <item>
      <title>clear results/outputs generated by procedures within macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/clear-results-outputs-generated-by-procedures-within-macro/m-p/591714#M15254</link>
      <description>&lt;P&gt;Hello members,&lt;/P&gt;
&lt;P&gt;How can I clear the results and outputs generated by the procedures within a macro? For example, for the following code. How can I only keep the data2 in within the macro and clear the intermediate results generated by&amp;nbsp;% macro bydomain (conditon1=a, condition2=b); before run&amp;nbsp;% macro bydomain (conditon1=c, condition2=d);?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data data2;&lt;/P&gt;
&lt;P&gt;set data1;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;% macro bydomain (conditon1, condition2);&lt;/P&gt;
&lt;P&gt;data data2;&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%mend;&lt;/P&gt;
&lt;P&gt;% macro bydomain (conditon1=a, condition2=b);&lt;/P&gt;
&lt;P&gt;% macro bydomain (conditon1=c, condition2=d);&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks so much!!!&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2019 21:31:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/clear-results-outputs-generated-by-procedures-within-macro/m-p/591714#M15254</guid>
      <dc:creator>TX_STAR</dc:creator>
      <dc:date>2019-09-25T21:31:49Z</dc:date>
    </item>
    <item>
      <title>Re: clear results/outputs generated by procedures within macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/clear-results-outputs-generated-by-procedures-within-macro/m-p/591716#M15255</link>
      <description>&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2015/05/28/five-reasons-ods-exclude.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2015/05/28/five-reasons-ods-exclude.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ODS SELECT and ODS EXCLUDE are what are needed. Or NOPRINT within the various procs.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2019 21:37:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/clear-results-outputs-generated-by-procedures-within-macro/m-p/591716#M15255</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-09-25T21:37:07Z</dc:date>
    </item>
    <item>
      <title>Re: clear results/outputs generated by procedures within macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/clear-results-outputs-generated-by-procedures-within-macro/m-p/591718#M15256</link>
      <description>&lt;P&gt;First thing would be to provide a more detailed description and possibly use different data set names in the example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You only actually show one data set inside the macro, repeating the name of one outside, and it is not clear what you want to keep.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Typically I would use proc datasets to delete any datasets that I don't want. Either at the beginning of a macro to prevent reuse of an existing set or at the end of the macro to clean up before it ends.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The syntax is&lt;/P&gt;
&lt;P&gt;Proc datasets library=somelib;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; delete datasetname;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you may want the NOPRINT option to reduce any output in the log&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2019 21:42:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/clear-results-outputs-generated-by-procedures-within-macro/m-p/591718#M15256</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-09-25T21:42:29Z</dc:date>
    </item>
    <item>
      <title>Re: clear results/outputs generated by procedures within macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/clear-results-outputs-generated-by-procedures-within-macro/m-p/591719#M15257</link>
      <description>&lt;P&gt;Incase you you are trying to just delete specific intermediate datasets only, try this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro bydomain (conditon1, condition2);

	proc datasets nolist lib=work mtype=data;
		delete data2;
	quit;

	data data2;
		...

		run;
%mend;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2019 21:43:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/clear-results-outputs-generated-by-procedures-within-macro/m-p/591719#M15257</guid>
      <dc:creator>r_behata</dc:creator>
      <dc:date>2019-09-25T21:43:17Z</dc:date>
    </item>
    <item>
      <title>Re: clear results/outputs generated by procedures within macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/clear-results-outputs-generated-by-procedures-within-macro/m-p/591722#M15259</link>
      <description>I use a naming convention, with _ to start the name for all my intermediary tables. Then you can drop them using a prefix shortcut which will clear all at once. &lt;BR /&gt;&lt;BR /&gt;delete _:;</description>
      <pubDate>Wed, 25 Sep 2019 21:48:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/clear-results-outputs-generated-by-procedures-within-macro/m-p/591722#M15259</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-09-25T21:48:48Z</dc:date>
    </item>
    <item>
      <title>Re: clear results/outputs generated by procedures within macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/clear-results-outputs-generated-by-procedures-within-macro/m-p/592325#M15343</link>
      <description>I moved the following code inside the macro, the problem solved. But my solution might not be best of efficient one. What happened was When I run the second macro call (conditon1=c, condition2=d) after running the first call (conditon1=a, condition2=b), the N count of the data2 was not right. I guess sas keeps temporary data that replaced initial data2. When I call the 2nd macro, the data2 was not correct one. When I keep the following code inside the macro, each call will start with a initial data2. Hopefully this time I am clear. Thank you all. &lt;BR /&gt;Data data2;&lt;BR /&gt;set data1;&lt;BR /&gt;run;</description>
      <pubDate>Fri, 27 Sep 2019 21:09:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/clear-results-outputs-generated-by-procedures-within-macro/m-p/592325#M15343</guid>
      <dc:creator>TX_STAR</dc:creator>
      <dc:date>2019-09-27T21:09:14Z</dc:date>
    </item>
  </channel>
</rss>

