<?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: Where statement in SAS Code and Usage in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Where-statement-in-SAS-Code-and-Usage/m-p/793589#M254375</link>
    <description>&lt;P&gt;Oh that is it.&amp;nbsp; IN only works when it is the start of the variable which in this case it is not.&amp;nbsp; I just don't remember "where" statements working in a SAS data step. The second line works but looks weird to me. Thanks for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 31 Jan 2022 19:25:03 GMT</pubDate>
    <dc:creator>cbrotz</dc:creator>
    <dc:date>2022-01-31T19:25:03Z</dc:date>
    <item>
      <title>Where statement in SAS Code and Usage</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-statement-in-SAS-Code-and-Usage/m-p/793559#M254365</link>
      <description>&lt;P&gt;I used to use the IN:() function in SAS.&amp;nbsp; It does not seem to work anymore or I am writing wrong.&amp;nbsp; I see that a WHERE statement can be used with a wildcard?&amp;nbsp; the second line of code below seems to work but the AND operator is not turning blue.&amp;nbsp; Not a big deal but kind of strange.&amp;nbsp; Can anyone fill me in if I am missing something here?&lt;/P&gt;&lt;P&gt;I want ALL level2 that contain the word&amp;nbsp; "PLACARD"&amp;nbsp; Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IF ORGGROUP = 'KEY' AND LEVEL2 IN: ('PLACARDS');&lt;BR /&gt;where ORGGROUP='KEY' AND LEVEL2 like '%PLACARDS%';&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jan 2022 17:39:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-statement-in-SAS-Code-and-Usage/m-p/793559#M254365</guid>
      <dc:creator>cbrotz</dc:creator>
      <dc:date>2022-01-31T17:39:13Z</dc:date>
    </item>
    <item>
      <title>Re: Where statement in SAS Code and Usage</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-statement-in-SAS-Code-and-Usage/m-p/793562#M254366</link>
      <description>&lt;P&gt;Show you log with the IN attempt and why you think it doesn't work, as in values of the variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I suggest the most likely case is that your variable Level2 does not have the CASE (upper case as shown) that you supplied. See this example&lt;/P&gt;
&lt;PRE&gt;data example;
   x = 'abc';
   y = x in: ('AB');
   z = x in: ('ab');
run;&lt;/PRE&gt;
&lt;P&gt;OR that you are looking for something other than the beginning of the string such as this:&lt;/P&gt;
&lt;PRE&gt;data example;
   x = 'abc';
   z = x in: ('bc');
run;&lt;/PRE&gt;
&lt;P&gt;IN: is going to expect the compared value to start the string and match case.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jan 2022 17:47:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-statement-in-SAS-Code-and-Usage/m-p/793562#M254366</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-01-31T17:47:23Z</dc:date>
    </item>
    <item>
      <title>Re: Where statement in SAS Code and Usage</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-statement-in-SAS-Code-and-Usage/m-p/793569#M254369</link>
      <description>&lt;P&gt;Your WHERE condition is checking for the PLACARDS string anywhere in the string LEVEL2.&lt;/P&gt;
&lt;P&gt;But your IN operator is checking only for PLACARDS at the start of the string.&lt;/P&gt;
&lt;P&gt;If you want to check for PLACARDS anywhere in the string using the INDEX() function instead of the IN operator.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jan 2022 18:31:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-statement-in-SAS-Code-and-Usage/m-p/793569#M254369</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-01-31T18:31:28Z</dc:date>
    </item>
    <item>
      <title>Re: Where statement in SAS Code and Usage</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-statement-in-SAS-Code-and-Usage/m-p/793589#M254375</link>
      <description>&lt;P&gt;Oh that is it.&amp;nbsp; IN only works when it is the start of the variable which in this case it is not.&amp;nbsp; I just don't remember "where" statements working in a SAS data step. The second line works but looks weird to me. Thanks for your help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 Jan 2022 19:25:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-statement-in-SAS-Code-and-Usage/m-p/793589#M254375</guid>
      <dc:creator>cbrotz</dc:creator>
      <dc:date>2022-01-31T19:25:03Z</dc:date>
    </item>
    <item>
      <title>Re: Where statement in SAS Code and Usage</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Where-statement-in-SAS-Code-and-Usage/m-p/793803#M254467</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/112131"&gt;@cbrotz&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Oh that is it.&amp;nbsp; IN only works when it is the start of the variable which in this case it is not.&amp;nbsp; I just don't remember "where" statements working in a SAS data step. The second line works but looks weird to me. Thanks for your help!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Not quite.&amp;nbsp; IN&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;: &lt;/STRONG&gt;&lt;FONT color="#000000"&gt;, with the colon, is "begins with". A simple IN (&amp;lt;list of values&amp;gt;) does an exact match.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Feb 2022 14:56:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Where-statement-in-SAS-Code-and-Usage/m-p/793803#M254467</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-02-01T14:56:03Z</dc:date>
    </item>
  </channel>
</rss>

