<?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 design in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-design/m-p/523757#M142341</link>
    <description>&lt;P&gt;You're right, I didn't give much detail. I ended up figuring out a solution after playing with it for a bit.&lt;/P&gt;</description>
    <pubDate>Fri, 28 Dec 2018 13:02:18 GMT</pubDate>
    <dc:creator>rlafond</dc:creator>
    <dc:date>2018-12-28T13:02:18Z</dc:date>
    <item>
      <title>Macro design</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-design/m-p/523694#M142301</link>
      <description>&lt;P&gt;I have a reference table similar to this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;Group&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;SalesID&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;Team A&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;123&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;Team A&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;234&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;Team A&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;345&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;Team A&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;456&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;Team B&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;567&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;Team B&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;796&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;Team B&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;210&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;Team B&lt;/FONT&gt;&lt;/TD&gt;&lt;TD&gt;&lt;FONT color="#000000" face="Calibri" size="3"&gt;999&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want each iteration of the macro to run for each Group value (or put another way, my final output is per Group), but the lookup value in all of my transaction tables is SalesID. So if I was running a report based on Team B, I would use (in PROC SQL, for example) SalesID in ('567','796','210','999').&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A SalesID only ever belongs to one Group, but the number of SalesID per Group varies.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My experience with macros is limited, so when I think about doing this I'm not sure how I could write my code so that each iteration of the macro runs off of multiple values for one parameter (SalesID).&lt;/P&gt;</description>
      <pubDate>Thu, 27 Dec 2018 19:10:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-design/m-p/523694#M142301</guid>
      <dc:creator>rlafond</dc:creator>
      <dc:date>2018-12-27T19:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: Macro design</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-design/m-p/523696#M142302</link>
      <description>&lt;P&gt;Just join the reference table to the data table and use by processing with group. No macro needed.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Dec 2018 19:38:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-design/m-p/523696#M142302</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-12-27T19:38:46Z</dc:date>
    </item>
    <item>
      <title>Re: Macro design</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-design/m-p/523723#M142327</link>
      <description>&lt;P&gt;You've given us nothing to go on, to evaluate whether macro language should be used at all.&amp;nbsp; You will need to show a little bit of what&amp;nbsp; happens later for each GROUP.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To start, just subset all the data:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;create table subset as select * from main_table&lt;/P&gt;
&lt;P&gt;where SalesID in (select SalesID from reference_table);&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That should give you all the observations (for all groups) that you are interested in, since the same SalesID never appears in multiple groups.&amp;nbsp; But the rest of the answer depends on you painting a clearer idea of the goal.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Dec 2018 23:05:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-design/m-p/523723#M142327</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-12-27T23:05:03Z</dc:date>
    </item>
    <item>
      <title>Re: Macro design</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-design/m-p/523757#M142341</link>
      <description>&lt;P&gt;You're right, I didn't give much detail. I ended up figuring out a solution after playing with it for a bit.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Dec 2018 13:02:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-design/m-p/523757#M142341</guid>
      <dc:creator>rlafond</dc:creator>
      <dc:date>2018-12-28T13:02:18Z</dc:date>
    </item>
  </channel>
</rss>

