<?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: Using Perl to see if there is a match between different names in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Using-Perl-to-see-if-there-is-a-match-between-different-names/m-p/255342#M268888</link>
    <description>&lt;P&gt;Thank you! This explains at least part of the issue that I am having. Also, to provide some example, every name in my ratecenter variable is 8 characters long, and I want to see if there are any matches between the first 6 characters (out of &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; for any of the rate center names.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, ratecenter takes on the following form:&lt;/P&gt;&lt;P&gt;&lt;U&gt;ratecenter&lt;/U&gt;&lt;/P&gt;&lt;P&gt;XXXXXXYY&lt;/P&gt;&lt;P&gt;XYZXYZXY&lt;/P&gt;&lt;P&gt;YYYYYYYY&lt;/P&gt;&lt;P&gt;YYYYYYZZ&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My hopes is that my function will return 'YYYYYYYY' and 'YYYYYYZZ' as ratecenter names that have a match for the first 6 characters.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 08 Mar 2016 19:39:19 GMT</pubDate>
    <dc:creator>kevinmc87</dc:creator>
    <dc:date>2016-03-08T19:39:19Z</dc:date>
    <item>
      <title>Using Perl to see if there is a match between different names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Perl-to-see-if-there-is-a-match-between-different-names/m-p/255327#M268886</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to see if there is match between the first 6 characters of any of my rate center names. I thought that I was using the \w character correctly, but it doesn't seem to be working. For example, if there was a rate center name XXXXXXYY and a ratecenter named XXXXXXXY, I would want a match returned. However, when I type my code, I am getting a dataset that returns all of the rate centers, and no matches.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data work.perl;&lt;/P&gt;&lt;P&gt;set work.ratecenter;&lt;/P&gt;&lt;P&gt;if _n_=1 then do;&lt;/P&gt;&lt;P&gt;retain re;&lt;/P&gt;&lt;P&gt;re=prxparse("/\w\w\w\w\w\w/");&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;if prxmatch(re, ratecenter);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If anyone could let me know what my issue is, and why I am not seeing a return of the rate center names that match the first 6 letters, please let me know.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2016 19:33:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Perl-to-see-if-there-is-a-match-between-different-names/m-p/255327#M268886</guid>
      <dc:creator>kevinmc87</dc:creator>
      <dc:date>2016-03-08T19:33:43Z</dc:date>
    </item>
    <item>
      <title>Re: Using Perl to see if there is a match between different names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Perl-to-see-if-there-is-a-match-between-different-names/m-p/255341#M268887</link>
      <description>Your regular expression simply matches any 'ratecenter' made up of six word characters. It would do nothing to match two different values in the variable 'ratecenter' against each other.&lt;BR /&gt;&lt;BR /&gt;PRX functions would not be an appropriate choice of function for what you are explaining you want to do.&lt;BR /&gt;&lt;BR /&gt;To provide you with some better help it would be good for you to include some example of your data and structure of 'work.ratecenter' You can use 'substr(ratecenter,1,6)' to get the first 6 chars and then use that to perform your comparison for other 'ratecenter'</description>
      <pubDate>Tue, 08 Mar 2016 19:33:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Perl-to-see-if-there-is-a-match-between-different-names/m-p/255341#M268887</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2016-03-08T19:33:08Z</dc:date>
    </item>
    <item>
      <title>Re: Using Perl to see if there is a match between different names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Perl-to-see-if-there-is-a-match-between-different-names/m-p/255342#M268888</link>
      <description>&lt;P&gt;Thank you! This explains at least part of the issue that I am having. Also, to provide some example, every name in my ratecenter variable is 8 characters long, and I want to see if there are any matches between the first 6 characters (out of &lt;span class="lia-unicode-emoji" title=":smiling_face_with_sunglasses:"&gt;😎&lt;/span&gt; for any of the rate center names.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, ratecenter takes on the following form:&lt;/P&gt;&lt;P&gt;&lt;U&gt;ratecenter&lt;/U&gt;&lt;/P&gt;&lt;P&gt;XXXXXXYY&lt;/P&gt;&lt;P&gt;XYZXYZXY&lt;/P&gt;&lt;P&gt;YYYYYYYY&lt;/P&gt;&lt;P&gt;YYYYYYZZ&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My hopes is that my function will return 'YYYYYYYY' and 'YYYYYYZZ' as ratecenter names that have a match for the first 6 characters.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2016 19:39:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Perl-to-see-if-there-is-a-match-between-different-names/m-p/255342#M268888</guid>
      <dc:creator>kevinmc87</dc:creator>
      <dc:date>2016-03-08T19:39:19Z</dc:date>
    </item>
    <item>
      <title>Re: Using Perl to see if there is a match between different names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Perl-to-see-if-there-is-a-match-between-different-names/m-p/255348#M268889</link>
      <description>&lt;P&gt;I should also note that I'm not searching for a particular string - I need to know if there is a&amp;nbsp;string that match any other strings. I have over 900 rate center names. I'm not sure if I can use substr() unless I have a particular string in mind that I am searching for, which I do not have.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2016 19:58:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Perl-to-see-if-there-is-a-match-between-different-names/m-p/255348#M268889</guid>
      <dc:creator>kevinmc87</dc:creator>
      <dc:date>2016-03-08T19:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: Using Perl to see if there is a match between different names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Perl-to-see-if-there-is-a-match-between-different-names/m-p/255351#M268890</link>
      <description>&lt;P&gt;Would this perhaps be easier:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc freq data=ratecenter;&lt;/P&gt;
&lt;P&gt;tables ratecenter;&lt;/P&gt;
&lt;P&gt;format ratecenter $6.;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That will give you a table with counts of how many times each six-character value appears in the data.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2016 20:07:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Perl-to-see-if-there-is-a-match-between-different-names/m-p/255351#M268890</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-03-08T20:07:48Z</dc:date>
    </item>
    <item>
      <title>Re: Using Perl to see if there is a match between different names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Perl-to-see-if-there-is-a-match-between-different-names/m-p/255353#M268891</link>
      <description>&lt;P&gt;To compliment the method from Astounding, which is the simplist method I can come up with, the following will provide you all the duplicates with the matches attached&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ratecenter $8.;
cards;
XXXXXXYY
XYZXYZXY
YYYYYYYY
YYYYYYZZ
;
run;

data v_have / view=v_have;
set have;
common6= substr(ratecenter,1,6);
proc sort data=v_have out=_want nounikey; by common6; 
run;

proc transpose data=_want out=want(drop=_:) prefix=ratecenter;
var ratecenter;
by common6;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Obs common6 ratecenter1 ratecenter2 1&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;YYYYYY&lt;/TD&gt;&lt;TD&gt;YYYYYYYY&lt;/TD&gt;&lt;TD&gt;YYYYYYZZ&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Mar 2016 20:12:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Perl-to-see-if-there-is-a-match-between-different-names/m-p/255353#M268891</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2016-03-08T20:12:23Z</dc:date>
    </item>
    <item>
      <title>Re: Using Perl to see if there is a match between different names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-Perl-to-see-if-there-is-a-match-between-different-names/m-p/255354#M268892</link>
      <description>&lt;P&gt;Something like this might get you started. This will tend to create duplicates because if center a matches center b then b matches a.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
   create table matches as
   select distrinct a.ratecenter as center1, b.ratecenter as center2
   from (select distict ratecenter from have) as a left join
        (select distict ratecenter from have) as b
        on substr(a.ratecenter,1,6) = substr(b.ratecenter,1,6)
   where a.ratecenter ne b.ratecenter;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 08 Mar 2016 20:12:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-Perl-to-see-if-there-is-a-match-between-different-names/m-p/255354#M268892</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-03-08T20:12:14Z</dc:date>
    </item>
  </channel>
</rss>

