<?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: Macro with PRXMATCH in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-with-PRXMATCH/m-p/989849#M380238</link>
    <description>&lt;P&gt;Use the INPUT() function to convert the string into the number it represents and then it will be much easier to compare.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For more help show some examples of the input strings you need to test.&lt;/P&gt;</description>
    <pubDate>Thu, 18 Jun 2026 15:24:12 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2026-06-18T15:24:12Z</dc:date>
    <item>
      <title>Macro with PRXMATCH</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-with-PRXMATCH/m-p/989765#M380231</link>
      <description>&lt;P&gt;Hello Experts,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Today, I'm using the following code to extract rates. I'm wondering if I can create a macro using&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;PRXMATCH&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;to check the values,&amp;nbsp; from 0.50% to 2.70% ?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if (prxmatch("/\b0[,\.]45\s*%/",lb_lg)&amp;gt;0
or prxmatch("/\b0[,\.]45\s*%/",lb_)&amp;gt;0)
or (prxmatch("/\b0[,\.]45\s*%/",lb_lg)&amp;gt;0
or prxmatch("/\b0[,\.]45\s*%/",lb)&amp;gt;0) then
do;
Taux=0.0045;
end;

if (prxmatch("/\b0[,\.]50\s*%/",lb_lg)&amp;gt;0
or prxmatch("/\b0[,\.]50\s*%/",lb)&amp;gt;0)
or (prxmatch("/\b0[,\.]5\s*%/",lb_lg)&amp;gt;0
or prxmatch("/\b0[,\.]5\s*%/",lb)&amp;gt;0) then
do;
Taux=0.005;
end;

if prxmatch("/\b1(\.0\b|\.0\%|\%|\s)/",lb_lg)&amp;gt;0 
or prxmatch("/\b1(\.0\b|\.0\%|\%|\s)/",lb)&amp;gt;0 then
do;
Taux=0.01;
end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you !&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2026 19:50:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-with-PRXMATCH/m-p/989765#M380231</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2026-06-17T19:50:50Z</dc:date>
    </item>
    <item>
      <title>Re: Macro with PRXMATCH</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-with-PRXMATCH/m-p/989767#M380232</link>
      <description>&lt;P&gt;I think far easier is to convert the text which you describe as&amp;nbsp;0.50% to 2.70% to actual numbers and then checking becomes much much much much easier. And then likely no macro is needed.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2026 20:22:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-with-PRXMATCH/m-p/989767#M380232</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2026-06-17T20:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: Macro with PRXMATCH</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-with-PRXMATCH/m-p/989848#M380237</link>
      <description>&lt;P&gt;Thank you, Paige Miller, but I didn't fully understand your idea.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2026 15:08:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-with-PRXMATCH/m-p/989848#M380237</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2026-06-18T15:08:14Z</dc:date>
    </item>
    <item>
      <title>Re: Macro with PRXMATCH</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-with-PRXMATCH/m-p/989849#M380238</link>
      <description>&lt;P&gt;Use the INPUT() function to convert the string into the number it represents and then it will be much easier to compare.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For more help show some examples of the input strings you need to test.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2026 15:24:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-with-PRXMATCH/m-p/989849#M380238</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2026-06-18T15:24:12Z</dc:date>
    </item>
    <item>
      <title>Re: Macro with PRXMATCH</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-with-PRXMATCH/m-p/989859#M380239</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/286185"&gt;@SASdevAnneMarie&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you, Paige Miller, but I didn't fully understand your idea.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The whole idea is that numbers are easier to handle as numbers than if you leave them as text. If there was something I could advise less experienced people to do, it would be to ALWAYS convert text strings which are really numbers to actual numbers.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2026 17:06:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-with-PRXMATCH/m-p/989859#M380239</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2026-06-18T17:06:11Z</dc:date>
    </item>
    <item>
      <title>Re: Macro with PRXMATCH</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-with-PRXMATCH/m-p/989869#M380240</link>
      <description>Thank you, Tom.&lt;BR /&gt;I'm wondering if I can do this with "prxmatch" :&lt;BR /&gt;%macro mymacro(var);&lt;BR /&gt; if (prxmatch("/\b0[,\.]&amp;amp;VAR.\s*%/",lb_lg)&amp;gt;0 then ....&lt;BR /&gt;%mend;&lt;BR /&gt;%mymacro(var=50);</description>
      <pubDate>Thu, 18 Jun 2026 19:22:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-with-PRXMATCH/m-p/989869#M380240</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2026-06-18T19:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: Macro with PRXMATCH</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-with-PRXMATCH/m-p/989933#M380242</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/286185"&gt;@SASdevAnneMarie&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thank you, Tom.&lt;BR /&gt;I'm wondering if I can do this with "prxmatch" :&lt;BR /&gt;%macro mymacro(var);&lt;BR /&gt;if (prxmatch("/\b0[,\.]&amp;amp;VAR.\s*%/",lb_lg)&amp;gt;0 then ....&lt;BR /&gt;%mend;&lt;BR /&gt;%mymacro(var=50);&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Your are wondering if you can do this with prxmatch. The answer is for you to try it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;it is impossible for me to advise you further since I don't know what you are trying to do. Would you please explain what you are trying to do? Please explain in words without reference to PRXMATCH or any other code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jun 2026 22:30:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-with-PRXMATCH/m-p/989933#M380242</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2026-06-19T22:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: Macro with PRXMATCH</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-with-PRXMATCH/m-p/989947#M380246</link>
      <description>&lt;P&gt;Note that since you are using two different variables as your sources, Lb_lg and Lb your code example quite likely is not returning what you would want because you would require if/then/else structures. consider if lb_lg has a value of .45 and Lb is .5 (given the appropriate other string characters). Do you want Taux to be 0.0045 or 0.005? Without an ELSE between the first and second IF/then the second comparison will reset Taux to 0.005 after it had been set to 0.0045 in the first block.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would also suggest using these rates as numeric and investigate the SELECT / WHEN comparison structure to get a clearer code for the hierarchy with two apparently similarly ranged variables. Of course if there was only a single variable involved an custom format likely could be used to remove the logic completely out of the data step.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jun 2026 05:37:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-with-PRXMATCH/m-p/989947#M380246</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2026-06-22T05:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: Macro with PRXMATCH</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-with-PRXMATCH/m-p/989952#M380247</link>
      <description>Thank you, Ballardw!</description>
      <pubDate>Mon, 22 Jun 2026 08:18:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-with-PRXMATCH/m-p/989952#M380247</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2026-06-22T08:18:30Z</dc:date>
    </item>
  </channel>
</rss>

