<?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: using Where and Keep in a set statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/using-Where-and-Keep-in-a-set-statement/m-p/447400#M283333</link>
    <description>&lt;P&gt;Yes, that's perfectly possible. I'd just change the order of the two dataset options, as SAS executes the keep first and the where later.&lt;/P&gt;
&lt;P&gt;In a dataset option, you can only apply the where to variables that are kept, as apposed to SQL, where you can set a where condition with variables not included in the select.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you also use a rename= option, the order should be&lt;/P&gt;
&lt;P&gt;keep=&lt;/P&gt;
&lt;P&gt;rename=&lt;/P&gt;
&lt;P&gt;where=&lt;/P&gt;
&lt;P&gt;as that is the order in which SAS executes the option, so that the code as written represents the logical order.&lt;/P&gt;</description>
    <pubDate>Wed, 21 Mar 2018 13:06:59 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-03-21T13:06:59Z</dc:date>
    <item>
      <title>using Where and Keep in a set statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-Where-and-Keep-in-a-set-statement/m-p/447390#M283332</link>
      <description>&lt;P&gt;I am trying to determine if I can combine a keep and a where in a set statement.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data sf;&lt;BR /&gt;set screen (where=(sf_flag='Y') keep = ( cno patno sf_flag) );&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Mar 2018 12:32:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-Where-and-Keep-in-a-set-statement/m-p/447390#M283332</guid>
      <dc:creator>tanya_henderson</dc:creator>
      <dc:date>2018-03-21T12:32:25Z</dc:date>
    </item>
    <item>
      <title>Re: using Where and Keep in a set statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/using-Where-and-Keep-in-a-set-statement/m-p/447400#M283333</link>
      <description>&lt;P&gt;Yes, that's perfectly possible. I'd just change the order of the two dataset options, as SAS executes the keep first and the where later.&lt;/P&gt;
&lt;P&gt;In a dataset option, you can only apply the where to variables that are kept, as apposed to SQL, where you can set a where condition with variables not included in the select.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you also use a rename= option, the order should be&lt;/P&gt;
&lt;P&gt;keep=&lt;/P&gt;
&lt;P&gt;rename=&lt;/P&gt;
&lt;P&gt;where=&lt;/P&gt;
&lt;P&gt;as that is the order in which SAS executes the option, so that the code as written represents the logical order.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Mar 2018 13:06:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/using-Where-and-Keep-in-a-set-statement/m-p/447400#M283333</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-03-21T13:06:59Z</dc:date>
    </item>
  </channel>
</rss>

