<?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 drop variable that might not exist in given dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-drop-variable-that-might-not-exist-in-given-dataset/m-p/409199#M279525</link>
    <description>&lt;P&gt;You can insert this line before your DATA step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;options dkricond=NoWarn;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then after the DATA step, switch back to the one that you prefer:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;options dkricond=Warn;&lt;/P&gt;
&lt;P&gt;options dkricond=Error;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Think of this as &lt;STRONG&gt;D&lt;/STRONG&gt;rop &lt;STRONG&gt;K&lt;/STRONG&gt;eep &lt;STRONG&gt;R&lt;/STRONG&gt;ename on &lt;STRONG&gt;I&lt;/STRONG&gt;nput &lt;STRONG&gt;Cond&lt;/STRONG&gt;ition.&lt;/P&gt;</description>
    <pubDate>Tue, 31 Oct 2017 16:18:31 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2017-10-31T16:18:31Z</dc:date>
    <item>
      <title>How to drop variable that might not exist in given dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-drop-variable-that-might-not-exist-in-given-dataset/m-p/409162#M279522</link>
      <description>&lt;P&gt;I would like to write something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data want;

set have (drop=pk_: fk_: bk_:);

run;


&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem occurs when there is no variable that starts with fk_, is it possible to set it conditionally (with out necessity to write macro that checks whether variable exists in a given file)? Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 15:09:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-drop-variable-that-might-not-exist-in-given-dataset/m-p/409162#M279522</guid>
      <dc:creator>Uknown_user</dc:creator>
      <dc:date>2017-10-31T15:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to drop variable that might not exist in given dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-drop-variable-that-might-not-exist-in-given-dataset/m-p/409179#M279524</link>
      <description>You can consider turning off the errors generated by the DROP/KEEP statements not listing, see the SAS Options list for the specific command. 

If you include that statement within the data step it gives a NOTE not an error. 

Or, as you noted, you can use macro logic. 

Or, you could use call execute/DO SUBL to generate your code conditionally based on the variables - similar to a macro.</description>
      <pubDate>Tue, 31 Oct 2017 15:32:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-drop-variable-that-might-not-exist-in-given-dataset/m-p/409179#M279524</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-10-31T15:32:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to drop variable that might not exist in given dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-drop-variable-that-might-not-exist-in-given-dataset/m-p/409199#M279525</link>
      <description>&lt;P&gt;You can insert this line before your DATA step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;options dkricond=NoWarn;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then after the DATA step, switch back to the one that you prefer:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;options dkricond=Warn;&lt;/P&gt;
&lt;P&gt;options dkricond=Error;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Think of this as &lt;STRONG&gt;D&lt;/STRONG&gt;rop &lt;STRONG&gt;K&lt;/STRONG&gt;eep &lt;STRONG&gt;R&lt;/STRONG&gt;ename on &lt;STRONG&gt;I&lt;/STRONG&gt;nput &lt;STRONG&gt;Cond&lt;/STRONG&gt;ition.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 16:18:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-drop-variable-that-might-not-exist-in-given-dataset/m-p/409199#M279525</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-10-31T16:18:31Z</dc:date>
    </item>
  </channel>
</rss>

