<?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 deleting a dataset if a condition is met in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/deleting-a-dataset-if-a-condition-is-met/m-p/125829#M34608</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there a way to use proc datasets and delete with certain conditions?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, I have dataset A and I want to delete if it the mean of one of its variables is less than a certain number. I have that mean stored in a macro variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I notice that it wont let me put a regular if statement in proc datasets. Is there another way to do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FYI, the reason I need to is I am creating hundreds of datasets with a do loop, and I only want the datasets stored if they are meeting a condition, or else too much room would be made up in the end.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 02 Mar 2013 16:57:07 GMT</pubDate>
    <dc:creator>Xamius32</dc:creator>
    <dc:date>2013-03-02T16:57:07Z</dc:date>
    <item>
      <title>deleting a dataset if a condition is met</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/deleting-a-dataset-if-a-condition-is-met/m-p/125829#M34608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there a way to use proc datasets and delete with certain conditions?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example, I have dataset A and I want to delete if it the mean of one of its variables is less than a certain number. I have that mean stored in a macro variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I notice that it wont let me put a regular if statement in proc datasets. Is there another way to do this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FYI, the reason I need to is I am creating hundreds of datasets with a do loop, and I only want the datasets stored if they are meeting a condition, or else too much room would be made up in the end.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Mar 2013 16:57:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/deleting-a-dataset-if-a-condition-is-met/m-p/125829#M34608</guid>
      <dc:creator>Xamius32</dc:creator>
      <dc:date>2013-03-02T16:57:07Z</dc:date>
    </item>
    <item>
      <title>Re: deleting a dataset if a condition is met</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/deleting-a-dataset-if-a-condition-is-met/m-p/125830#M34609</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you are already using a macro then you can use conditional logic (%IF %THEN etc).&lt;/P&gt;&lt;P&gt;Or you can just generate the code and then execute it. &lt;/P&gt;&lt;P&gt;For example you might do what you want with PROC SQL ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data x;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; set sashelp.class;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;proc sql noprint ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;select case when (mean(age)&amp;lt;14) then 'proc delete data=x;run;'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else ' ' end&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;into :code&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;from x&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;quit;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;amp;code;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Mar 2013 17:48:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/deleting-a-dataset-if-a-condition-is-met/m-p/125830#M34609</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-03-02T17:48:33Z</dc:date>
    </item>
    <item>
      <title>Re: deleting a dataset if a condition is met</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/deleting-a-dataset-if-a-condition-is-met/m-p/125831#M34610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yea, thanks for the help, i feel dumb not thinking outside the box there. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Mar 2013 20:09:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/deleting-a-dataset-if-a-condition-is-met/m-p/125831#M34610</guid>
      <dc:creator>Xamius32</dc:creator>
      <dc:date>2013-03-02T20:09:55Z</dc:date>
    </item>
  </channel>
</rss>

