<?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 Pattern matching for mutation in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Pattern-matching-for-mutation/m-p/565864#M11266</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think the new prxmatch should work but I don't know how&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dataset 1 has a variable that has these type of mutations:&amp;nbsp; M200V/I,&amp;nbsp; &amp;nbsp;M200M/A/N/K, M200V/K,&amp;nbsp; &amp;nbsp;M200M/K,&amp;nbsp; M200I/K,&amp;nbsp; K65K, K65K/A/B,&amp;nbsp; K65J,&amp;nbsp; M200Z&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dataset 2 has a list of mutations that we want to compare to:&lt;/P&gt;&lt;P&gt;M200V/I/K, K65A/B/C,&amp;nbsp; C140J&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So when I compare the variable in dataset 1 to the list in dataset 2.&amp;nbsp; I want to say every one of the mutations in dataset 1 find a match in dataset 2 except K65K, K65J, M200Z&lt;/P&gt;&lt;P&gt;(has to match M200 or K65,&amp;nbsp; then anything after that, we just need to match any letters after the digits)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance&lt;/P&gt;</description>
    <pubDate>Thu, 13 Jun 2019 14:40:23 GMT</pubDate>
    <dc:creator>Saspert1947</dc:creator>
    <dc:date>2019-06-13T14:40:23Z</dc:date>
    <item>
      <title>Pattern matching for mutation</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Pattern-matching-for-mutation/m-p/565864#M11266</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think the new prxmatch should work but I don't know how&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dataset 1 has a variable that has these type of mutations:&amp;nbsp; M200V/I,&amp;nbsp; &amp;nbsp;M200M/A/N/K, M200V/K,&amp;nbsp; &amp;nbsp;M200M/K,&amp;nbsp; M200I/K,&amp;nbsp; K65K, K65K/A/B,&amp;nbsp; K65J,&amp;nbsp; M200Z&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;dataset 2 has a list of mutations that we want to compare to:&lt;/P&gt;&lt;P&gt;M200V/I/K, K65A/B/C,&amp;nbsp; C140J&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So when I compare the variable in dataset 1 to the list in dataset 2.&amp;nbsp; I want to say every one of the mutations in dataset 1 find a match in dataset 2 except K65K, K65J, M200Z&lt;/P&gt;&lt;P&gt;(has to match M200 or K65,&amp;nbsp; then anything after that, we just need to match any letters after the digits)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2019 14:40:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Pattern-matching-for-mutation/m-p/565864#M11266</guid>
      <dc:creator>Saspert1947</dc:creator>
      <dc:date>2019-06-13T14:40:23Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern matching for mutation</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Pattern-matching-for-mutation/m-p/565869#M11268</link>
      <description>&lt;P&gt;Could you please try the below code&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data dataset1;
input mut :$100.;
code=prxchange('s/(\w\d+)(\w.*)/$1/',-1,compress(mut));
cards;
M200V/I
M200M/A/N/K 
M200V/K   
M200M/K  
M200I/K  
K65K
K65K/A/B  
K65J  
M200Z
;

data dataset2;
input mut2 :$100.;
code=prxchange('s/(\w\d+)(\w.*)/$1/',-1,compress(mut2));
cards;
M200V/I/K
K65A/B/C 
C140J
;

proc sort data=dataset2 nodupkey;
by code;
run;

proc sort data=dataset1 ;
by code mut;
run;


data want;
merge dataset1(in=a) dataset2(in=b);
by code;
if a and b;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Jun 2019 14:53:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Pattern-matching-for-mutation/m-p/565869#M11268</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2019-06-13T14:53:08Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern matching for mutation</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Pattern-matching-for-mutation/m-p/565882#M11272</link>
      <description>&lt;P&gt;Thanks Jag,&amp;nbsp; your code will match the 2 datasets by code but how do you compare the letters after the code?&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2019 15:10:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Pattern-matching-for-mutation/m-p/565882#M11272</guid>
      <dc:creator>Saspert1947</dc:creator>
      <dc:date>2019-06-13T15:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: Pattern matching for mutation</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Pattern-matching-for-mutation/m-p/565890#M11273</link>
      <description>&lt;P&gt;could you please try the below one&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data dataset1;
input mut :$100.;
code=prxchange('s/(\w\d+)(\w.*)/$1/',-1,compress(mut));
cards;
M200V/I
M200M/A/N/K 
M200V/K   
M200M/K  
M200I/K  
K65K
K65K/A/B  
K65J  
M200Z
;

data dataset12;
set dataset1;
do i = 1 to countw(compress(mut),'/');
letters=prxchange('s/(\w\d+)(\w.*)/$2/',-1,scan(compress(mut),i,'/'));
output;
end;
drop i;
run;

data dataset2;
input mut2 :$100.;
code=prxchange('s/(\w\d+)(\w.*)/$1/',-1,compress(mut2));
cards;
M200V/I/K
K65A/B/C 
C140J
;

data dataset22;
set dataset2;
do i = 1 to countw(compress(mut2),'/');
letters=prxchange('s/(\w\d+)(\w.*)/$2/',-1,scan(compress(mut2),i,'/'));
output;
end;
drop i;
run;


proc sort data=dataset22 nodupkey;
by code letters;
run;

proc sort data=dataset12 ;
by code letters;
run;


data want;
merge dataset12(in=a) dataset22(in=b);
by code letters;
if a and b;
run;&lt;BR /&gt;&lt;BR /&gt;proc sort data=want nodupkey;&lt;BR /&gt;by mut;&lt;BR /&gt;run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Jun 2019 15:29:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Pattern-matching-for-mutation/m-p/565890#M11273</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2019-06-13T15:29:33Z</dc:date>
    </item>
  </channel>
</rss>

