<?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: SAS macro - search for values and assign values from different variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-macro-search-for-values-and-assign-values-from-different/m-p/784568#M250400</link>
    <description>&lt;P&gt;That's good news you got a solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As a tip for the future, saying “&lt;SPAN&gt;didn't succeed” with no other explanation never works. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;We need to see the LOG, if there are errors in the log; or we need to see the incorrect output. And an explanation of “didn't succeed” is almost always helpful.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 07 Dec 2021 17:02:33 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2021-12-07T17:02:33Z</dc:date>
    <item>
      <title>SAS macro - search for values and assign values from different variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-macro-search-for-values-and-assign-values-from-different/m-p/784517#M250375</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Seeking for a help to build that into working macro.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Case when orig_nm LIKE '%KRAKEN%' then orig_acct_id&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; when benef_nm LIKE '%KRAKEN%' then benef_acct_id&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; when scnd_orig_nm LIKE '%KRAKEN%' then scnd_orig_acct_id&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;when scnd_benef_nm LIKE '%KRAKEN%' then scnd_benef_acct_id&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; when orig_nm LIKE '%BINANCE%' then orig_acct_id&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; when benef_nm LIKE '%BINANCE%' then benef_acct_id&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; when scnd_orig_nm LIKE '%BINANCE%' then scnd_orig_acct_id&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;when scnd_benef_nm LIKE '%BINANCE%' then scnd_benef_acct_id&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Generally the list of crypto platforms in LIKE is huge and dynamic, so I don't want to repeat "when" 300 times and then modify it once I add new entities. I would like a macro that pulls platforms names out of my list search for it in "orig_nm", "benef_nm" etc. and once it finds it, it assigns a value from corresponding acct number fields within the same records.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So I create one variable that holds account numbers for crypto platforms, wherever it finds it.&amp;nbsp; Is there anyone who possibly could help with this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Dec 2021 13:25:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-macro-search-for-values-and-assign-values-from-different/m-p/784517#M250375</guid>
      <dc:creator>mwilk</dc:creator>
      <dc:date>2021-12-07T13:25:27Z</dc:date>
    </item>
    <item>
      <title>Re: SAS macro - search for values and assign values from different variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-macro-search-for-values-and-assign-values-from-different/m-p/784519#M250376</link>
      <description>&lt;P&gt;&lt;SPAN style="font-family: inherit;"&gt;In an earlier thread on this subject, you marked an answer that showed how to do this as the correct answer:&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-family: inherit;"&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/macro-with-a-list-of-strings-from-table/m-p/782195#M249359" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/macro-with-a-list-of-strings-from-table/m-p/782195#M249359&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Dec 2021 13:44:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-macro-search-for-values-and-assign-values-from-different/m-p/784519#M250376</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-12-07T13:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: SAS macro - search for values and assign values from different variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-macro-search-for-values-and-assign-values-from-different/m-p/784521#M250378</link>
      <description>not really. In previous problem, macro that found a crypto platform name within a searched field would create a variable with the value that it was looking for.&lt;BR /&gt;&lt;BR /&gt;For example, before it was:&lt;BR /&gt;&lt;BR /&gt;case when orig_nm LIKE '%KRAKEN%' then 'KRAKEN'&lt;BR /&gt;&lt;BR /&gt;what I'm looking for now is:&lt;BR /&gt;&lt;BR /&gt;case when orig_nm LIKE '%KRAKEN%' then orig_acct_id&lt;BR /&gt;&lt;BR /&gt;This is the difference which I'm unable to resolve using the other macro. Tried but failed to get it working as intended. Hope it clarifies. I was advised to create a new thread which I did.&lt;BR /&gt;&lt;BR /&gt;Regards</description>
      <pubDate>Tue, 07 Dec 2021 13:55:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-macro-search-for-values-and-assign-values-from-different/m-p/784521#M250378</guid>
      <dc:creator>mwilk</dc:creator>
      <dc:date>2021-12-07T13:55:27Z</dc:date>
    </item>
    <item>
      <title>Re: SAS macro - search for values and assign values from different variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-macro-search-for-values-and-assign-values-from-different/m-p/784540#M250386</link>
      <description>&lt;P&gt;Show us what you have tried.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Give us a partial list of these crypto platforms&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Give us a partial list of the variable names&lt;/P&gt;</description>
      <pubDate>Tue, 07 Dec 2021 14:59:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-macro-search-for-values-and-assign-values-from-different/m-p/784540#M250386</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-12-07T14:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: SAS macro - search for values and assign values from different variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-macro-search-for-values-and-assign-values-from-different/m-p/784543#M250387</link>
      <description>&lt;P&gt;Tried this but didn't succeed. Then tried to change this part "%let field=%scan(&amp;amp;fields,&amp;amp;i);" to "%let field=%scan(&amp;amp;fields,&amp;amp;j);" - didn't succeed either. However, I got help on my old thread. So I got a solution already &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro new_loop(texts, &lt;BR /&gt;fields=ORIG_NM BENEF_NM SCND_ORIG_NM SCND_BENEF_NM SEND_INSTN_NM);&lt;BR /&gt;%local i j like_str text; &lt;BR /&gt;%let texts=%upcase(&amp;amp;texts); &lt;BR /&gt;%do i=1 %to %sysfunc(countw(&amp;amp;texts)); &lt;BR /&gt;%let text=%scan(&amp;amp;texts,&amp;amp;i); &lt;BR /&gt;%let field=%scan(&amp;amp;fields,&amp;amp;i); &lt;BR /&gt;%let like_str=%unquote(%nrstr(%'%%)&amp;amp;text%nrstr(%%%')); &lt;BR /&gt;when upper(%scan(&amp;amp;fields,1)) like &amp;amp;like_str &lt;BR /&gt;%do j=2 %to %sysfunc(countw(&amp;amp;fields)); &lt;BR /&gt;or upper(%scan(&amp;amp;fields,&amp;amp;j)) like &amp;amp;like_str &lt;BR /&gt;%end; &lt;BR /&gt;then %sysfunc(quote(&amp;amp;field,%str(%'))) &lt;BR /&gt;%put _local_; &lt;BR /&gt;%end; &lt;BR /&gt;%mend;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Dec 2021 15:01:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-macro-search-for-values-and-assign-values-from-different/m-p/784543#M250387</guid>
      <dc:creator>mwilk</dc:creator>
      <dc:date>2021-12-07T15:01:41Z</dc:date>
    </item>
    <item>
      <title>Re: SAS macro - search for values and assign values from different variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-macro-search-for-values-and-assign-values-from-different/m-p/784568#M250400</link>
      <description>&lt;P&gt;That's good news you got a solution.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As a tip for the future, saying “&lt;SPAN&gt;didn't succeed” with no other explanation never works. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;We need to see the LOG, if there are errors in the log; or we need to see the incorrect output. And an explanation of “didn't succeed” is almost always helpful.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Dec 2021 17:02:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-macro-search-for-values-and-assign-values-from-different/m-p/784568#M250400</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-12-07T17:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: SAS macro - search for values and assign values from different variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-macro-search-for-values-and-assign-values-from-different/m-p/784866#M250457</link>
      <description>&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2021 10:23:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-macro-search-for-values-and-assign-values-from-different/m-p/784866#M250457</guid>
      <dc:creator>mwilk</dc:creator>
      <dc:date>2021-12-08T10:23:42Z</dc:date>
    </item>
  </channel>
</rss>

