<?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: Can I use specific numbers series in a where statement? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Can-I-use-specific-numbers-series-in-a-where-statement/m-p/857990#M37877</link>
    <description>&lt;P&gt;Yes, it was in sequence and the between statement worked. Thank you!&lt;/P&gt;</description>
    <pubDate>Thu, 09 Feb 2023 11:17:43 GMT</pubDate>
    <dc:creator>Sandeep77</dc:creator>
    <dc:date>2023-02-09T11:17:43Z</dc:date>
    <item>
      <title>Can I use specific numbers series in a where statement?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Can-I-use-specific-numbers-series-in-a-where-statement/m-p/857981#M37873</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I am using a code where I have used a where statement like&amp;nbsp; where t1.client_code in ('LBG001','LBG002','LBG003');. I want to write a similar code but the client_code is from LBG004 to LBG042. So I want to know is there any option in SAS to do this or I have to write manually from 004 to 042?&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2023 10:37:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Can-I-use-specific-numbers-series-in-a-where-statement/m-p/857981#M37873</guid>
      <dc:creator>Sandeep77</dc:creator>
      <dc:date>2023-02-09T10:37:41Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use specific numbers series in a where statement?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Can-I-use-specific-numbers-series-in-a-where-statement/m-p/857988#M37876</link>
      <description>&lt;P&gt;With your " t1.client_code" I have to assume that you are using this where in Proc SQL. SQL in general is very verbose. So the may not be a way around this.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is chance, slim and be extremely careful with this, if &lt;STRONG&gt;all&lt;/STRONG&gt; of the values of interest are sequential that you could use&lt;/P&gt;
&lt;PRE&gt; where t1.client_code  between 'LBG001' and 'LBG003'&lt;/PRE&gt;
&lt;P&gt;This will not yield expected results if the length of the values changes&amp;nbsp; due to the way character values are compared:&lt;/P&gt;
&lt;PRE&gt;data example;
   input code $;
datalines;
LBG001
LBG002
LBG003
LBG004
LBG007
LBG00222
LBG000
LBG00
LB
;

proc sql;
   create table want as
   select *
   from example
   where code between 'LBG001' and 'LBG003'
   ;
quit;
&lt;/PRE&gt;
&lt;P&gt;Because the values of the between range have 6 characters the longer LBG00222 stops comparing at the first 2 and is "between" the range limits even though the second 2 would make a person think it doesn't fit. It may be possible to provide other restrictions in the Where, such as "and length(code)=6" but the particulars of each set will make this a potential exercise in making headaches.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2023 11:03:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Can-I-use-specific-numbers-series-in-a-where-statement/m-p/857988#M37876</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-02-09T11:03:45Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use specific numbers series in a where statement?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Can-I-use-specific-numbers-series-in-a-where-statement/m-p/857990#M37877</link>
      <description>&lt;P&gt;Yes, it was in sequence and the between statement worked. Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2023 11:17:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Can-I-use-specific-numbers-series-in-a-where-statement/m-p/857990#M37877</guid>
      <dc:creator>Sandeep77</dc:creator>
      <dc:date>2023-02-09T11:17:43Z</dc:date>
    </item>
    <item>
      <title>Re: Can I use specific numbers series in a where statement?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Can-I-use-specific-numbers-series-in-a-where-statement/m-p/857991#M37878</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/391779"&gt;@Sandeep77&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Yes, it was in sequence and the between statement worked. Thank you!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I might suggest a test of creating data set of the distinct values of the code and testing on that reduced set just in case. I do not like to consider the number of times I have been given a list of "all the values" only to have others actually appear in the data. Character values especially have issues with mixed case.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Feb 2023 11:20:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Can-I-use-specific-numbers-series-in-a-where-statement/m-p/857991#M37878</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-02-09T11:20:16Z</dc:date>
    </item>
  </channel>
</rss>

