<?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 a list of strings from table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/macro-with-a-list-of-strings-from-table/m-p/782190#M249354</link>
    <description>&lt;P&gt;You already asked this question and marked it solved&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Case-when-conditions-macro/m-p/779313" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Case-when-conditions-macro/m-p/779313&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 24 Nov 2021 11:28:55 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2021-11-24T11:28:55Z</dc:date>
    <item>
      <title>macro with a list of strings from table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-with-a-list-of-strings-from-table/m-p/782177#M249346</link>
      <description>&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying (for a few days) to make a code below a macro loop. I would like to one of the where conditions to be a macro where strings like "coinbase" etc are iterating along with fields I want them to be searched within. I have like 70 of those strings and don't want to repeat 100 times. Can anyone help me to create a macro that actually works? I have created one but only when I put one name in it it works. If I put more, then it downloads everything like there was no condition....I have a list of crypto platforms in excel csv sheet and want my macro to take it from there and search for each word within 4 variables. Anyone could help with it? Spend few days but no luck:(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;where&lt;BR /&gt;( UPPER(WT.ORIG_NM) LIKE '%COINBASE%'&lt;BR /&gt;OR UPPER(WT.ORIG_NM) LIKE '%BITFINEX%'&lt;BR /&gt;OR UPPER(WT.ORIG_NM) LIKE '%KRAKEN%'&lt;BR /&gt;OR UPPER(WT.ORIG_NM) LIKE '%BINANCE%'&lt;BR /&gt;OR UPPER(WT.SCND_ORIG_NM) LIKE '%COINBASE%'&lt;BR /&gt;OR UPPER(WT.SCND_ORIG_NM) LIKE '%BITFINEX%'&lt;BR /&gt;OR UPPER(WT.SCND_ORIG_NM) LIKE '%KRAKEN%'&lt;BR /&gt;OR UPPER(WT.SCND_ORIG_NM) LIKE '%BINANCE%'&lt;BR /&gt;OR UPPER(WT.BENEF_NM) LIKE '%COINBASE%'&lt;BR /&gt;OR UPPER(WT.BENEF_NM) LIKE '%BITFINEX%'&lt;BR /&gt;OR UPPER(WT.BENEF_NM) LIKE '%KRAKEN%'&lt;BR /&gt;OR UPPER(WT.BENEF_NM) LIKE '%BINANCE%'&lt;/P&gt;</description>
      <pubDate>Wed, 24 Nov 2021 10:30:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-with-a-list-of-strings-from-table/m-p/782177#M249346</guid>
      <dc:creator>mwilk</dc:creator>
      <dc:date>2021-11-24T10:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: macro with a list of strings from table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-with-a-list-of-strings-from-table/m-p/782190#M249354</link>
      <description>&lt;P&gt;You already asked this question and marked it solved&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Case-when-conditions-macro/m-p/779313" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/Case-when-conditions-macro/m-p/779313&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Nov 2021 11:28:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-with-a-list-of-strings-from-table/m-p/782190#M249354</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-11-24T11:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: macro with a list of strings from table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-with-a-list-of-strings-from-table/m-p/782195#M249359</link>
      <description>No it was similar but different.... It was for case when. I tried to use and modify that macro for a week to make it work in this case but failed. Hence my ask for a help from people who knows how to do it....</description>
      <pubDate>Wed, 24 Nov 2021 11:55:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-with-a-list-of-strings-from-table/m-p/782195#M249359</guid>
      <dc:creator>mwilk</dc:creator>
      <dc:date>2021-11-24T11:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: macro with a list of strings from table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-with-a-list-of-strings-from-table/m-p/782197#M249360</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data wt;
input orig_nm :$20. scnd_orig_nm :$20.;
datalines;
xxcoinbasezz yyy
xxx yyy
xxx yyykrakenzz
;

%macro loop_over(variables,values);
%local i j;
%do i = 1 %to %sysfunc(countw(&amp;amp;variables.));
  %let var=%scan(&amp;amp;variables,&amp;amp;i.);
  %do j = 1 %to %sysfunc(countw(&amp;amp;values.));
    %if &amp;amp;j. ne 1 or &amp;amp;i. ne 1 %then %do; or %end;
    upcase(%scan(&amp;amp;variables,&amp;amp;i.)) like "%"!!"%scan(&amp;amp;values,&amp;amp;j.)"!!"%"
  %end;
%end;
%mend;

proc sql;
select * from wt
where (
%loop_over(orig_nm scnd_orig_nm,COINBASE KRAKEN)
);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Nov 2021 11:57:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-with-a-list-of-strings-from-table/m-p/782197#M249360</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-11-24T11:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: macro with a list of strings from table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-with-a-list-of-strings-from-table/m-p/782235#M249378</link>
      <description>thank you very very much!</description>
      <pubDate>Wed, 24 Nov 2021 15:16:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-with-a-list-of-strings-from-table/m-p/782235#M249378</guid>
      <dc:creator>mwilk</dc:creator>
      <dc:date>2021-11-24T15:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: macro with a list of strings from table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-with-a-list-of-strings-from-table/m-p/782416#M249421</link>
      <description>&lt;P&gt;May I only ask what double (!!) on both sides of LIKE are for?&lt;/P&gt;</description>
      <pubDate>Thu, 25 Nov 2021 10:08:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-with-a-list-of-strings-from-table/m-p/782416#M249421</guid>
      <dc:creator>mwilk</dc:creator>
      <dc:date>2021-11-25T10:08:30Z</dc:date>
    </item>
    <item>
      <title>Re: macro with a list of strings from table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-with-a-list-of-strings-from-table/m-p/782452#M249437</link>
      <description>&lt;P&gt;Two exclamation marks are the character concatenation operator (alternatively, you can use two pipe&lt;/P&gt;
&lt;PRE&gt;||&lt;/PRE&gt;
&lt;P&gt;characters).&lt;/P&gt;
&lt;P&gt;Splitting the percent signs away from the rest of the strings tricks the macro processor into not recognizing them as macro triggers. To mask them even further, you could use single quotes around the percent signs only:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;'%'!!"&amp;amp;macrovar."!!'%'&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The macro processor will only resolve the macro variable, and SQL will concatenate the strings to the %VALUE% you want. And SQL will first concatenate and then recognize the special LIKE characters.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Nov 2021 17:04:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-with-a-list-of-strings-from-table/m-p/782452#M249437</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-11-25T17:04:21Z</dc:date>
    </item>
    <item>
      <title>Re: macro with a list of strings from table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-with-a-list-of-strings-from-table/m-p/782854#M249570</link>
      <description>Thank you very much!!!</description>
      <pubDate>Mon, 29 Nov 2021 10:02:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-with-a-list-of-strings-from-table/m-p/782854#M249570</guid>
      <dc:creator>mwilk</dc:creator>
      <dc:date>2021-11-29T10:02:01Z</dc:date>
    </item>
  </channel>
</rss>

