<?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 Find a string and number from a list stored in 2 macro variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Find-a-string-and-number-from-a-list-stored-in-2-macro-variables/m-p/564182#M158223</link>
    <description>&lt;P&gt;Hi all,&lt;BR /&gt;&lt;BR /&gt;I'm looking to perform a search for a string and a number based on a template ( variations) this way :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let quant=[&lt;CODE class=" language-sas"&gt;quantity0&lt;/CODE&gt;,&lt;CODE class=" language-sas"&gt;quantity1&lt;/CODE&gt;,&lt;CODE class=" language-sas"&gt;quantity2&lt;/CODE&gt;,&lt;CODE class=" language-sas"&gt;quantity3&lt;/CODE&gt;,&lt;CODE class=" language-sas"&gt;quantity4&lt;/CODE&gt;,&lt;CODE class=" language-sas"&gt;quantity5&lt;/CODE&gt;,&lt;CODE class=" language-sas"&gt;quantity6&lt;/CODE&gt;,&lt;CODE class=" language-sas"&gt;quantity7&lt;/CODE&gt;,&lt;CODE class=" language-sas"&gt;quantity8&lt;/CODE&gt;];&lt;/P&gt;&lt;P&gt;%let fruits=[apples, pears];&lt;/P&gt;&lt;P&gt;%let fruit=[apple, pear];&lt;/P&gt;&lt;P&gt;%let &lt;STRONG&gt;variations&lt;/STRONG&gt;=[&lt;CODE class=" language-sas"&gt;red &amp;amp;fruits big &amp;amp;quant&lt;/CODE&gt;,&lt;CODE class=" language-sas"&gt;red &amp;amp;fruits &amp;amp;quant&lt;/CODE&gt;, blue&amp;nbsp;&lt;CODE class=" language-sas"&gt;&amp;amp;fruit&lt;/CODE&gt;&amp;nbsp;&amp;amp;quant, blue&amp;nbsp;&lt;CODE class=" language-sas"&gt;&amp;amp;fruit&lt;STRONG&gt;s&lt;/STRONG&gt;&lt;/CODE&gt;&amp;nbsp;&amp;amp;quant ]; ( and so on... there are many variations, the most imp&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
mytext ="somedays I'll collect red apples quantity5 and blue pear quantity3 and will eat them " ;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;the output is extracting the quantity based on the template &lt;STRONG&gt;variations&lt;/STRONG&gt;, in the case of data have:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;R&lt;STRONG&gt;A&lt;/STRONG&gt; = quantity5 ( for 'red &lt;STRONG&gt;apples&lt;/STRONG&gt; quantity 5)&lt;/P&gt;&lt;P&gt;B&lt;STRONG&gt;P&lt;/STRONG&gt; = quantity3 ( for 'blue &lt;STRONG&gt;pear&lt;/STRONG&gt; quantity 3)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;the standard search function is below, anyone knows how to perform a search with sas code ( not regex) with hprovided templates ?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if index(mytext,"red apples quantity 5")^=0 then RA=quantity5&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Thu, 06 Jun 2019 16:04:37 GMT</pubDate>
    <dc:creator>SIgnificatif</dc:creator>
    <dc:date>2019-06-06T16:04:37Z</dc:date>
    <item>
      <title>Find a string and number from a list stored in 2 macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-a-string-and-number-from-a-list-stored-in-2-macro-variables/m-p/564182#M158223</link>
      <description>&lt;P&gt;Hi all,&lt;BR /&gt;&lt;BR /&gt;I'm looking to perform a search for a string and a number based on a template ( variations) this way :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let quant=[&lt;CODE class=" language-sas"&gt;quantity0&lt;/CODE&gt;,&lt;CODE class=" language-sas"&gt;quantity1&lt;/CODE&gt;,&lt;CODE class=" language-sas"&gt;quantity2&lt;/CODE&gt;,&lt;CODE class=" language-sas"&gt;quantity3&lt;/CODE&gt;,&lt;CODE class=" language-sas"&gt;quantity4&lt;/CODE&gt;,&lt;CODE class=" language-sas"&gt;quantity5&lt;/CODE&gt;,&lt;CODE class=" language-sas"&gt;quantity6&lt;/CODE&gt;,&lt;CODE class=" language-sas"&gt;quantity7&lt;/CODE&gt;,&lt;CODE class=" language-sas"&gt;quantity8&lt;/CODE&gt;];&lt;/P&gt;&lt;P&gt;%let fruits=[apples, pears];&lt;/P&gt;&lt;P&gt;%let fruit=[apple, pear];&lt;/P&gt;&lt;P&gt;%let &lt;STRONG&gt;variations&lt;/STRONG&gt;=[&lt;CODE class=" language-sas"&gt;red &amp;amp;fruits big &amp;amp;quant&lt;/CODE&gt;,&lt;CODE class=" language-sas"&gt;red &amp;amp;fruits &amp;amp;quant&lt;/CODE&gt;, blue&amp;nbsp;&lt;CODE class=" language-sas"&gt;&amp;amp;fruit&lt;/CODE&gt;&amp;nbsp;&amp;amp;quant, blue&amp;nbsp;&lt;CODE class=" language-sas"&gt;&amp;amp;fruit&lt;STRONG&gt;s&lt;/STRONG&gt;&lt;/CODE&gt;&amp;nbsp;&amp;amp;quant ]; ( and so on... there are many variations, the most imp&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
mytext ="somedays I'll collect red apples quantity5 and blue pear quantity3 and will eat them " ;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;the output is extracting the quantity based on the template &lt;STRONG&gt;variations&lt;/STRONG&gt;, in the case of data have:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;R&lt;STRONG&gt;A&lt;/STRONG&gt; = quantity5 ( for 'red &lt;STRONG&gt;apples&lt;/STRONG&gt; quantity 5)&lt;/P&gt;&lt;P&gt;B&lt;STRONG&gt;P&lt;/STRONG&gt; = quantity3 ( for 'blue &lt;STRONG&gt;pear&lt;/STRONG&gt; quantity 3)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;the standard search function is below, anyone knows how to perform a search with sas code ( not regex) with hprovided templates ?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if index(mytext,"red apples quantity 5")^=0 then RA=quantity5&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2019 16:04:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-a-string-and-number-from-a-list-stored-in-2-macro-variables/m-p/564182#M158223</guid>
      <dc:creator>SIgnificatif</dc:creator>
      <dc:date>2019-06-06T16:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: Find a string and number from a list stored in 2 macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Find-a-string-and-number-from-a-list-stored-in-2-macro-variables/m-p/565468#M158774</link>
      <description>&lt;P&gt;Why do you exclude regex?&lt;/P&gt;
&lt;P&gt;After a quick look at your problem, i can't see any better way to solve this, than by using regex.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 06:16:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Find-a-string-and-number-from-a-list-stored-in-2-macro-variables/m-p/565468#M158774</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-06-12T06:16:25Z</dc:date>
    </item>
  </channel>
</rss>

