<?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: Select a strings length containing a range of numerical values that follow a letter in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Select-a-strings-length-containing-a-range-of-numerical-values/m-p/831400#M328522</link>
    <description>&lt;P&gt;Thank you. Now, this does work if I were to use this statement three times on two other columns following the same format? I have two other columns I want to pull where data starts with C and has anywhere from 8-10 digits following. Would I just put the whole statement in () with OR inside?&lt;BR /&gt;&lt;BR /&gt;Like: AND (PRXMATCH('/C\d{8,10}/', c.ADDRESS) OR PRXMATCH('/C\d{8,10}/', c.ADDRESS_1) OR PRXMATCH('/C\d{8,10}/', c.ADDRESS_2))&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 01 Sep 2022 12:32:16 GMT</pubDate>
    <dc:creator>RedUser77</dc:creator>
    <dc:date>2022-09-01T12:32:16Z</dc:date>
    <item>
      <title>Select a strings length containing a range of numerical values that follow a letter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-a-strings-length-containing-a-range-of-numerical-values/m-p/831355#M328501</link>
      <description>&lt;P&gt;Hello!&lt;BR /&gt;&lt;BR /&gt;I am having trouble figuring out how to select a certain column whose string starts with the letter C and ends with 8-10 numbers only. I know how to use 'C%' but am unable on how to figure out the string length in range part. Below I have it pulling anything from address that start with C. I just need to figure out how to implement the range of 8-10 numbers that follow that C into the sample code below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SELECT c.NEIGHBORS,&lt;BR /&gt;c.COUNTRY,&lt;BR /&gt;c.ADDRESS,&lt;BR /&gt;FROM DATA.SAMPLE a&lt;BR /&gt;LEFT JOIN DATA.SAMPLE_DIM b ON (a.CAR = b.CAR)&lt;BR /&gt;LEFT JOIN DATA.EXTRA c ON (a.COLOR = c.COLOR)&lt;BR /&gt;WHERE a.CAR LIKE 'Toyota'&amp;nbsp; AND c.INTERNET = 'Charter' AND c.ADDRESS LIKE 'C%';&lt;BR /&gt;QUIT;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2022 02:50:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-a-strings-length-containing-a-range-of-numerical-values/m-p/831355#M328501</guid>
      <dc:creator>RedUser77</dc:creator>
      <dc:date>2022-09-01T02:50:17Z</dc:date>
    </item>
    <item>
      <title>Re: Select a strings length containing a range of numerical values that follow a letter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-a-strings-length-containing-a-range-of-numerical-values/m-p/831358#M328504</link>
      <description>&lt;P&gt;The COUNTC function can count the number of specific characters:&lt;/P&gt;
&lt;P&gt;The function searches in the first parameter, the string to search, for the characters in the second position. The 'd' add all the digits so is just quicker than typing all the 0 through 9.&lt;/P&gt;
&lt;P&gt;Caveat: this will count the digits even if there are spaces or other letters in the middle. Since you haven't provided an actual examples of the string to search I am starting with a simple case. If you have other stuff you need to provide examples and which match your rule(s).&lt;/P&gt;
&lt;PRE&gt;data example;
   input str :$15.;
   nums = countc(str,'1','d');
datalines;
C1
C22
C345
C444
C4567
C12345678
C1234566788&lt;BR /&gt;C1111111111
;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/432777"&gt;@RedUser77&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello!&lt;BR /&gt;&lt;BR /&gt;I am having trouble figuring out how to select a certain column whose string starts with the letter C and ends with 8-10 numbers only. I know how to use 'C%' but am unable on how to figure out the string length in range part. Below I have it pulling anything from address that start with C. I just need to figure out how to implement the range of 8-10 numbers that follow that C into the sample code below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any ideas?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SELECT c.NEIGHBORS,&lt;BR /&gt;c.COUNTRY,&lt;BR /&gt;c.ADDRESS,&lt;BR /&gt;FROM DATA.SAMPLE a&lt;BR /&gt;LEFT JOIN DATA.SAMPLE_DIM b ON (a.CAR = b.CAR)&lt;BR /&gt;LEFT JOIN DATA.EXTRA c ON (a.COLOR = c.COLOR)&lt;BR /&gt;WHERE a.CAR LIKE 'Toyota'&amp;nbsp; AND c.INTERNET = 'Charter' AND c.ADDRESS LIKE 'C%';&lt;BR /&gt;QUIT;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2022 03:34:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-a-strings-length-containing-a-range-of-numerical-values/m-p/831358#M328504</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-09-01T03:34:13Z</dc:date>
    </item>
    <item>
      <title>Re: Select a strings length containing a range of numerical values that follow a letter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-a-strings-length-containing-a-range-of-numerical-values/m-p/831360#M328506</link>
      <description>This column, c.ADDRESS, has data populated in it such as 'D12345', 'C1234567', 'C12345678', 'C123456789', 'W123', 'CBDUEJDKS', etc. I want it to only return strings that start with C and have 8-10 numbers that follow. So, from this list, it should return C1234567, C12345678, and C123456789 only. Is there a way to implement this into the PROC SQL statement originally posted?</description>
      <pubDate>Thu, 01 Sep 2022 03:52:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-a-strings-length-containing-a-range-of-numerical-values/m-p/831360#M328506</guid>
      <dc:creator>RedUser77</dc:creator>
      <dc:date>2022-09-01T03:52:11Z</dc:date>
    </item>
    <item>
      <title>Re: Select a strings length containing a range of numerical values that follow a letter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-a-strings-length-containing-a-range-of-numerical-values/m-p/831362#M328507</link>
      <description>&lt;P&gt;Untested:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;and prxmatch('/C\d{8,10}/', c.address)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Sep 2022 05:19:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-a-strings-length-containing-a-range-of-numerical-values/m-p/831362#M328507</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-09-01T05:19:07Z</dc:date>
    </item>
    <item>
      <title>Re: Select a strings length containing a range of numerical values that follow a letter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-a-strings-length-containing-a-range-of-numerical-values/m-p/831395#M328519</link>
      <description>&lt;PRE&gt;data example;
   input str $15.;
   if prxmatch('/^C\d{8,10}$/i',strip(str)) then flag=1;
datalines;
C1
C22
C345
C444
C4567
C12345678
C1234566788
C1111111111
;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Sep 2022 12:14:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-a-strings-length-containing-a-range-of-numerical-values/m-p/831395#M328519</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-09-01T12:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: Select a strings length containing a range of numerical values that follow a letter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-a-strings-length-containing-a-range-of-numerical-values/m-p/831400#M328522</link>
      <description>&lt;P&gt;Thank you. Now, this does work if I were to use this statement three times on two other columns following the same format? I have two other columns I want to pull where data starts with C and has anywhere from 8-10 digits following. Would I just put the whole statement in () with OR inside?&lt;BR /&gt;&lt;BR /&gt;Like: AND (PRXMATCH('/C\d{8,10}/', c.ADDRESS) OR PRXMATCH('/C\d{8,10}/', c.ADDRESS_1) OR PRXMATCH('/C\d{8,10}/', c.ADDRESS_2))&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2022 12:32:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-a-strings-length-containing-a-range-of-numerical-values/m-p/831400#M328522</guid>
      <dc:creator>RedUser77</dc:creator>
      <dc:date>2022-09-01T12:32:16Z</dc:date>
    </item>
    <item>
      <title>Re: Select a strings length containing a range of numerical values that follow a letter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-a-strings-length-containing-a-range-of-numerical-values/m-p/831503#M328596</link>
      <description>&lt;P&gt;Yes.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2022 05:05:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-a-strings-length-containing-a-range-of-numerical-values/m-p/831503#M328596</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-09-02T05:05:22Z</dc:date>
    </item>
  </channel>
</rss>

