<?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: RLIKE in SAS EG in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/RLIKE-in-SAS-EG/m-p/560805#M33751</link>
    <description>&lt;P&gt;I wasn't sure about the whitespace situation between 'discountCode:' and the digits, so this might work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input changedfields $80.;
datalines;
discountCode:12345-&amp;gt;null
discountCode:67890-&amp;gt;null
discountCode: 87654-&amp;gt;null
discountCode:1x345-&amp;gt;null
something else
;

proc sql;
 create table want as select changedfields from have
  where prxmatch('/discountCode:(\s*(\d\d\d\d\d))-&amp;gt;null/',changedfields)&amp;gt;0;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 22 May 2019 12:39:40 GMT</pubDate>
    <dc:creator>ChrisHemedinger</dc:creator>
    <dc:date>2019-05-22T12:39:40Z</dc:date>
    <item>
      <title>RLIKE in SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/RLIKE-in-SAS-EG/m-p/560787#M33749</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Hi!&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We've just got access to SAS as a tool, and now I'm trying to translate my previous scripts from SQL.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having trouble finding a commando like "rlike" - if anyone could please help me?&lt;BR /&gt;I've tried to make an example her of what I'm trying to do:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SQL;&lt;BR /&gt;Create table test as&lt;BR /&gt;Select CreatedDate, DiscountCode, MemberId, ChangedFields&lt;BR /&gt;from my.source&lt;BR /&gt;where ChangedFIelds rlike 'discountCode:[0-9][0-9][0-9][0-9][0-9]-&amp;gt;null'&lt;BR /&gt;ORDER BY CreatedDate;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So.. How to do this in SAS EG?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2019 11:38:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/RLIKE-in-SAS-EG/m-p/560787#M33749</guid>
      <dc:creator>Linus69</dc:creator>
      <dc:date>2019-05-22T11:38:19Z</dc:date>
    </item>
    <item>
      <title>Re: RLIKE in SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/RLIKE-in-SAS-EG/m-p/560795#M33750</link>
      <description>&lt;P&gt;SAS does not provide such an operator (which looks like a LIKE with regular expressions to me).&lt;/P&gt;
&lt;P&gt;The straightforward thing to do (IMO) is using basic comparisons with substrings and testing for numeric data:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input changedfields $80.;
datalines;
discountCode:12345-&amp;gt;null
discountCode:67890-&amp;gt;null
discountCode:1x345-&amp;gt;null
something else
;

data want;
set have;
where
  index(ChangedFIelds,'discountCode:') = 1 and
  notdigit(substr(ChangedFIelds,14,5)) = 0 and
  substr(ChangedFIelds,19,6) = '-&amp;gt;null'
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Someone who is an expert on SAS perl regular expressions may come up with a more elegant solution.&lt;/P&gt;</description>
      <pubDate>Wed, 22 May 2019 12:09:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/RLIKE-in-SAS-EG/m-p/560795#M33750</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-05-22T12:09:23Z</dc:date>
    </item>
    <item>
      <title>Re: RLIKE in SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/RLIKE-in-SAS-EG/m-p/560805#M33751</link>
      <description>&lt;P&gt;I wasn't sure about the whitespace situation between 'discountCode:' and the digits, so this might work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input changedfields $80.;
datalines;
discountCode:12345-&amp;gt;null
discountCode:67890-&amp;gt;null
discountCode: 87654-&amp;gt;null
discountCode:1x345-&amp;gt;null
something else
;

proc sql;
 create table want as select changedfields from have
  where prxmatch('/discountCode:(\s*(\d\d\d\d\d))-&amp;gt;null/',changedfields)&amp;gt;0;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 May 2019 12:39:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/RLIKE-in-SAS-EG/m-p/560805#M33751</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2019-05-22T12:39:40Z</dc:date>
    </item>
    <item>
      <title>Re: RLIKE in SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/RLIKE-in-SAS-EG/m-p/561051#M33768</link>
      <description>&lt;P&gt;Thank you! That really sent me into the right direction&amp;nbsp;&lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 May 2019 06:27:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/RLIKE-in-SAS-EG/m-p/561051#M33768</guid>
      <dc:creator>Linus69</dc:creator>
      <dc:date>2019-05-23T06:27:26Z</dc:date>
    </item>
  </channel>
</rss>

