<?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: Select a right value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Select-a-right-value/m-p/922937#M363382</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/286185"&gt;@SASdevAnneMarie&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The issue is that the period (.) is a &lt;EM&gt;meta&lt;/EM&gt;character that "matches any single character except newline" (see table "&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p0s9ilagexmjl8n1u7e1t1jfnzlk.htm#n1rbair1boxew1n1uz3ekd9u0673" target="_blank" rel="noopener"&gt;Other Quantifiers&lt;/A&gt;" in the documentation). But if you "escape" it with a backslash (see table "&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p0s9ilagexmjl8n1u7e1t1jfnzlk.htm#n0mngd40ccrdrln15f0kr57hql5e" target="_blank" rel="noopener"&gt;General Constructs&lt;/A&gt;"), it matches the period "." as intended. I would also suggest using the "word boundary" metacharacter &lt;FONT face="courier new,courier"&gt;\b&lt;/FONT&gt; to avoid matches of "12,25", "41.75" etc.:&lt;/P&gt;
&lt;PRE&gt;&lt;FONT size="4"&gt;"/&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;\b&lt;/STRONG&gt;&lt;/FONT&gt;2,25|&lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;\b&lt;/FONT&gt;&lt;/STRONG&gt;2&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;\&lt;/STRONG&gt;&lt;/FONT&gt;.25|&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;\b&lt;/STRONG&gt;&lt;/FONT&gt;1,75|&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;\b&lt;/STRONG&gt;&lt;/FONT&gt;1&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;\&lt;/STRONG&gt;&lt;/FONT&gt;.75/"&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;But, of course, it depends on your data whether this makes sense or not (e.g., if you want to match the "2.25" in "Q2.25").&lt;/P&gt;</description>
    <pubDate>Thu, 04 Apr 2024 10:34:03 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2024-04-04T10:34:03Z</dc:date>
    <item>
      <title>Select a right value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-a-right-value/m-p/922923#M363375</link>
      <description>&lt;P&gt;Hello Experts,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;With&amp;nbsp;prxmath function I would like to select only the values 2,25 or 2.25, 1.75 or 1,75.&lt;/P&gt;
&lt;P&gt;So, in my code I have :&amp;nbsp; if prxmatch("m/2,25|2.25|1,75|1.75/oi",lb)&amp;gt;0 , but I don't know why this doesn't work, beacause I have in my selection 2.50.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank your for your help !&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2024 09:30:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-a-right-value/m-p/922923#M363375</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2024-04-04T09:30:29Z</dc:date>
    </item>
    <item>
      <title>Re: Select a right value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-a-right-value/m-p/922932#M363378</link>
      <description>&lt;P&gt;Explain in more detail. Show us the code. Show us a portion of the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, you should always show us your code that doesn't work. We have &lt;A href="https://communities.sas.com/t5/SAS-Programming/Value-from-a-precedent-row/m-p/919691#M362259" target="_self"&gt;asked for this&lt;/A&gt;&amp;nbsp; from you before. Do not make us ask repeatedly.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2024 10:20:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-a-right-value/m-p/922932#M363378</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-04-04T10:20:27Z</dc:date>
    </item>
    <item>
      <title>Re: Select a right value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-a-right-value/m-p/922937#M363382</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/286185"&gt;@SASdevAnneMarie&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The issue is that the period (.) is a &lt;EM&gt;meta&lt;/EM&gt;character that "matches any single character except newline" (see table "&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p0s9ilagexmjl8n1u7e1t1jfnzlk.htm#n1rbair1boxew1n1uz3ekd9u0673" target="_blank" rel="noopener"&gt;Other Quantifiers&lt;/A&gt;" in the documentation). But if you "escape" it with a backslash (see table "&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p0s9ilagexmjl8n1u7e1t1jfnzlk.htm#n0mngd40ccrdrln15f0kr57hql5e" target="_blank" rel="noopener"&gt;General Constructs&lt;/A&gt;"), it matches the period "." as intended. I would also suggest using the "word boundary" metacharacter &lt;FONT face="courier new,courier"&gt;\b&lt;/FONT&gt; to avoid matches of "12,25", "41.75" etc.:&lt;/P&gt;
&lt;PRE&gt;&lt;FONT size="4"&gt;"/&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;\b&lt;/STRONG&gt;&lt;/FONT&gt;2,25|&lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;\b&lt;/FONT&gt;&lt;/STRONG&gt;2&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;\&lt;/STRONG&gt;&lt;/FONT&gt;.25|&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;\b&lt;/STRONG&gt;&lt;/FONT&gt;1,75|&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;\b&lt;/STRONG&gt;&lt;/FONT&gt;1&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;\&lt;/STRONG&gt;&lt;/FONT&gt;.75/"&lt;/FONT&gt;&lt;/PRE&gt;
&lt;P&gt;But, of course, it depends on your data whether this makes sense or not (e.g., if you want to match the "2.25" in "Q2.25").&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2024 10:34:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-a-right-value/m-p/922937#M363382</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2024-04-04T10:34:03Z</dc:date>
    </item>
    <item>
      <title>Re: Select a right value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-a-right-value/m-p/922944#M363384</link>
      <description>Thank you ! That works ! Do you know please how  to add the condition and in this expression, like  "/\b2,25|\b2\.25|\b1,75|\b1\.75/ and 'RATE'".</description>
      <pubDate>Thu, 04 Apr 2024 11:53:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-a-right-value/m-p/922944#M363384</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2024-04-04T11:53:46Z</dc:date>
    </item>
    <item>
      <title>Re: Select a right value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-a-right-value/m-p/922960#M363388</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;Do you know please how to add the condition and in this expression, like "/\b2,25|\b2\.25|\b1,75|\b1\.75/ and 'RATE'".&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So you want to check if a string contains one (or more) of the numbers discussed previously and also the string "RATE" (or "'RATE'" with single quotes? Perhaps case-insensitive?)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could search for "RATE" with a separate function call (e.g., of the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p16rdsa30vmm43n1ej4936nwa01t.htm" target="_blank" rel="noopener"&gt;FINDW function&lt;/A&gt;). However, if you know positively that "RATE" would always occur &lt;EM&gt;before&lt;/EM&gt; (or always &lt;EM&gt;after&lt;/EM&gt;) the number, you can add it conveniently to the regular expression:&lt;/P&gt;
&lt;PRE&gt;"/&lt;FONT color="#3366FF"&gt;&lt;STRONG&gt;\bRATE\b.*(&lt;/STRONG&gt;&lt;/FONT&gt;\b2,25|\b2\.25|\b1,75|\b1\.75&lt;STRONG&gt;&lt;FONT color="#3366FF"&gt;)/i&lt;/FONT&gt;&lt;/STRONG&gt;"&lt;/PRE&gt;
&lt;P&gt;This regex matches &lt;FONT face="courier new,courier"&gt;RATE&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;rate&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;Rate&lt;/FONT&gt;, etc. (but &lt;EM&gt;not&lt;/EM&gt; &lt;FONT face="courier new,courier"&gt;St&lt;U&gt;rate&lt;/U&gt;gy&lt;/FONT&gt;, &lt;FONT face="courier new,courier"&gt;rated&lt;/FONT&gt;, etc.), followed by a&amp;nbsp;word boundary and a sequence of (zero or more) virtually arbitrary characters and then any of the four numbers of interest. So, example strings matching this pattern are&lt;/P&gt;
&lt;PRE&gt;Rate:1,75
The rate is exactly 2.25%.
estimated rate: 1.737 (95%-CI: 1.716-1.758)&lt;/PRE&gt;
&lt;P&gt;The latter match could be avoided by adding &lt;FONT face="courier new,courier"&gt;\b&lt;/FONT&gt; metacharacters after the numbers, but then &lt;FONT face="courier new,courier"&gt;2.250&lt;/FONT&gt; etc. would no longer match (without further extensions of the regex).&lt;/P&gt;</description>
      <pubDate>Thu, 04 Apr 2024 13:09:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-a-right-value/m-p/922960#M363388</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2024-04-04T13:09:14Z</dc:date>
    </item>
    <item>
      <title>Re: Select a right value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-a-right-value/m-p/922962#M363390</link>
      <description>Thank you very much !</description>
      <pubDate>Thu, 04 Apr 2024 13:19:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-a-right-value/m-p/922962#M363390</guid>
      <dc:creator>SASdevAnneMarie</dc:creator>
      <dc:date>2024-04-04T13:19:37Z</dc:date>
    </item>
  </channel>
</rss>

