<?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: PRXMATCH function with a macro variable (whose value contains a forward slash) not working in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PRXMATCH-function-with-a-macro-variable-whose-value-contains-a/m-p/934156#M367364</link>
    <description>&lt;P&gt;Your revisions to my code have worked. Thanks,&lt;/P&gt;</description>
    <pubDate>Sat, 29 Jun 2024 02:50:03 GMT</pubDate>
    <dc:creator>muhuri</dc:creator>
    <dc:date>2024-06-29T02:50:03Z</dc:date>
    <item>
      <title>PRXMATCH function with a macro variable (whose value contains a forward slash) not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PRXMATCH-function-with-a-macro-variable-whose-value-contains-a/m-p/933635#M367180</link>
      <description>&lt;P&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;&lt;FONT face="comic sans ms,sans-serif"&gt;I am using PRXMATCH with a Perl regular expression(RegEx) in a WHERE clause in PROC PRINT. The RegEx includes a macro variable containing a drug list and one of these drug names includes a forward slash.&amp;nbsp; I am getting an error even after using a escape character (back slash) in the RegEx.&amp;nbsp; I would appreciate your help resolve the issue.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&lt;SPAN&gt;&lt;FONT face="comic sans ms,sans-serif"&gt;Partial SAS Log:&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="comic sans ms,sans-serif"&gt;&lt;FONT size="2" color="#FF6600"&gt;ERROR: Invalid characters "ATROP \//i" after end delimiter "/" of regular expression&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2" color="#FF6600"&gt;"/Propantheline|Propoxyphene|Reserpine|Ticlopidine|Trimethobenzamide|DIPHEN/ATROP \//i".&lt;/FONT&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;* Create a macro variable of study drugs;
%let STUDY_DRUG_LIST = Propantheline|Propoxyphene|Reserpine|Ticlopidine|Trimethobenzamide|DIPHEN/ATROP;

* Create an example data set of prescription fills (patient ID and drug names) ;
Data work.pmed;
input dupersid: $10.  rxname $20.;
datalines;
2320038102 NITROFURANTN
2320038102 EZETIMIBE
2320038102 Propantheline
2320040101 Reserpine
2320040101 Reserpine
2320040101 NOVOLOG
2320040101 NOVOLOG
2320040105 DIPHEN/ATROP
2320040105 DIPHEN/ATROP
2320040105 DIPHEN/ATROP
;

* List observations using PRXMATCH with a Perl regular expression in the WHERE clause (Study drug list);
proc print data=work.pmed;
where prxmatch ("/&amp;amp;study_drug_list2 \//i", rxname);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Jun 2024 04:59:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PRXMATCH-function-with-a-macro-variable-whose-value-contains-a/m-p/933635#M367180</guid>
      <dc:creator>muhuri</dc:creator>
      <dc:date>2024-06-25T04:59:25Z</dc:date>
    </item>
    <item>
      <title>Re: PRXMATCH function with a macro variable (whose value contains a forward slash) not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PRXMATCH-function-with-a-macro-variable-whose-value-contains-a/m-p/933636#M367181</link>
      <description>Corrected: where prxmatch ("/&amp;amp;study_drug_list\//i", rxname);</description>
      <pubDate>Tue, 25 Jun 2024 05:01:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PRXMATCH-function-with-a-macro-variable-whose-value-contains-a/m-p/933636#M367181</guid>
      <dc:creator>muhuri</dc:creator>
      <dc:date>2024-06-25T05:01:12Z</dc:date>
    </item>
    <item>
      <title>Re: PRXMATCH function with a macro variable (whose value contains a forward slash) not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PRXMATCH-function-with-a-macro-variable-whose-value-contains-a/m-p/933638#M367183</link>
      <description>&lt;P&gt;You need to escape the slash:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let study_drug_list = Propantheline|Propoxyphene|Reserpine|Ticlopidine|Trimethobenzamide|DIPHEN\/TROP;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can do that on the fly if needed:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let study_drug_list2 = %sysfunc(transtrn(&amp;amp;study_drug_list,/,\/));
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where prxmatch ("/&amp;amp;study_drug_list2/i", RXNAME);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2024 05:22:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PRXMATCH-function-with-a-macro-variable-whose-value-contains-a/m-p/933638#M367183</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2024-06-25T05:22:19Z</dc:date>
    </item>
    <item>
      <title>Re: PRXMATCH function with a macro variable (whose value contains a forward slash) not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PRXMATCH-function-with-a-macro-variable-whose-value-contains-a/m-p/934156#M367364</link>
      <description>&lt;P&gt;Your revisions to my code have worked. Thanks,&lt;/P&gt;</description>
      <pubDate>Sat, 29 Jun 2024 02:50:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PRXMATCH-function-with-a-macro-variable-whose-value-contains-a/m-p/934156#M367364</guid>
      <dc:creator>muhuri</dc:creator>
      <dc:date>2024-06-29T02:50:03Z</dc:date>
    </item>
    <item>
      <title>Re: PRXMATCH function with a macro variable (whose value contains a forward slash) not working</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PRXMATCH-function-with-a-macro-variable-whose-value-contains-a/m-p/934157#M367365</link>
      <description>&lt;P&gt;It has worked. Thanks,&lt;/P&gt;</description>
      <pubDate>Sat, 29 Jun 2024 02:52:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PRXMATCH-function-with-a-macro-variable-whose-value-contains-a/m-p/934157#M367365</guid>
      <dc:creator>muhuri</dc:creator>
      <dc:date>2024-06-29T02:52:00Z</dc:date>
    </item>
  </channel>
</rss>

