<?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: Expression to drop the values in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Expression-to-drop-the-values/m-p/486284#M15148</link>
    <description>&lt;P&gt;Really?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;where substr(khiref,1,3) ne "003";&lt;/PRE&gt;
&lt;P&gt;Do note you can't use&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;KHIREF &lt;SPAN class="token operator"&gt;not&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;in&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;'003'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; as KHIREF&lt;/LI-CODE&gt;
&lt;P&gt;What are you trying to do here (this is where test data/output wanted would come in handy!!).&amp;nbsp; Perhaps you need a case when:&lt;/P&gt;
&lt;PRE&gt;case when substr(khiref,1,3) ne "003" then khiref else "" end as khiref&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 13 Aug 2018 08:15:45 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-08-13T08:15:45Z</dc:date>
    <item>
      <title>Expression to drop the values</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Expression-to-drop-the-values/m-p/486271#M15145</link>
      <description>&lt;P&gt;I want to drop the values if the variable 'KHIREF' begins with '003'. It has following values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;002134&lt;/P&gt;
&lt;P&gt;003423&lt;/P&gt;
&lt;P&gt;001342&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So if I put &lt;STRONG&gt;'KHIREF not in '003'&lt;/STRONG&gt; under expression in SAS DI across that variable &amp;nbsp;I'm getting syntax error as mentioned below. Could you please guide me to resolve the issue?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;2102                (KHIREF not in '003') as KHIREF length = 20
                                   _____
                                   22
                                   76
ERROR 22-322: Syntax error, expecting one of the following: (, SELECT.  

ERROR 76-322: Syntax error, statement will be ignored.&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Aug 2018 07:39:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Expression-to-drop-the-values/m-p/486271#M15145</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2018-08-13T07:39:18Z</dc:date>
    </item>
    <item>
      <title>Re: Expression to drop the values</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Expression-to-drop-the-values/m-p/486279#M15146</link>
      <description>&lt;P&gt;An "in" list needs to be enclosed in brackets; if you only have a single value, use = instead of in.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Aug 2018 08:10:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Expression-to-drop-the-values/m-p/486279#M15146</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-08-13T08:10:26Z</dc:date>
    </item>
    <item>
      <title>Re: Expression to drop the values</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Expression-to-drop-the-values/m-p/486280#M15147</link>
      <description>&lt;P&gt;And use the substr() function if you only need to compare with a substring.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Aug 2018 08:11:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Expression-to-drop-the-values/m-p/486280#M15147</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-08-13T08:11:55Z</dc:date>
    </item>
    <item>
      <title>Re: Expression to drop the values</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Expression-to-drop-the-values/m-p/486284#M15148</link>
      <description>&lt;P&gt;Really?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;where substr(khiref,1,3) ne "003";&lt;/PRE&gt;
&lt;P&gt;Do note you can't use&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;KHIREF &lt;SPAN class="token operator"&gt;not&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;in&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;'003'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; as KHIREF&lt;/LI-CODE&gt;
&lt;P&gt;What are you trying to do here (this is where test data/output wanted would come in handy!!).&amp;nbsp; Perhaps you need a case when:&lt;/P&gt;
&lt;PRE&gt;case when substr(khiref,1,3) ne "003" then khiref else "" end as khiref&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Aug 2018 08:15:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Expression-to-drop-the-values/m-p/486284#M15148</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-08-13T08:15:45Z</dc:date>
    </item>
    <item>
      <title>Re: Expression to drop the values</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Expression-to-drop-the-values/m-p/486494#M15151</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/8409"&gt;@Babloo&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;This belongs into the Where clause and not the column expression.&lt;/P&gt;
&lt;P&gt;In the where clause use a LIKE operator. Once set-up check the DIS generated code. You need to see something like:&lt;/P&gt;
&lt;PRE&gt;where not khiref like '003%'&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Aug 2018 22:07:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Expression-to-drop-the-values/m-p/486494#M15151</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-08-13T22:07:47Z</dc:date>
    </item>
  </channel>
</rss>

