<?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: Intersection of two macro? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Intersection-of-two-macro/m-p/612944#M178947</link>
    <description>&lt;P&gt;Scan iteratively through one macro variable and use findw into the second:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let in1=A B C;
%let in2=A B D;

data _null_;
length result $10;
do i = 1 to countw("&amp;amp;in1.");
  if findw("&amp;amp;in2.",scan("&amp;amp;in1.",i)) then result = catx(' ',result,scan("&amp;amp;in1.",i));
end;
call symputx('result',result);
run;

%put &amp;amp;result.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 19 Dec 2019 08:09:56 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2019-12-19T08:09:56Z</dc:date>
    <item>
      <title>Intersection of two macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Intersection-of-two-macro/m-p/612941#M178945</link>
      <description>I have two macro variables. Let's say the first includes A B C and the second includes A B D. Can I make the intersection of the two macro variables, which contains A and B?</description>
      <pubDate>Thu, 19 Dec 2019 07:40:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Intersection-of-two-macro/m-p/612941#M178945</guid>
      <dc:creator>braam</dc:creator>
      <dc:date>2019-12-19T07:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: Intersection of two macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Intersection-of-two-macro/m-p/612944#M178947</link>
      <description>&lt;P&gt;Scan iteratively through one macro variable and use findw into the second:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let in1=A B C;
%let in2=A B D;

data _null_;
length result $10;
do i = 1 to countw("&amp;amp;in1.");
  if findw("&amp;amp;in2.",scan("&amp;amp;in1.",i)) then result = catx(' ',result,scan("&amp;amp;in1.",i));
end;
call symputx('result',result);
run;

%put &amp;amp;result.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Dec 2019 08:09:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Intersection-of-two-macro/m-p/612944#M178947</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-12-19T08:09:56Z</dc:date>
    </item>
  </channel>
</rss>

