<?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: Can a macro be used to create a table and then filtered multiple times? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Can-a-macro-be-used-to-create-a-table-and-then-filtered-multiple/m-p/802569#M315951</link>
    <description>&lt;P&gt;Use the payment types as BY or CLASS variable in your analytics procedures.&lt;/P&gt;</description>
    <pubDate>Thu, 17 Mar 2022 07:11:21 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2022-03-17T07:11:21Z</dc:date>
    <item>
      <title>Can a macro be used to create a table and then filtered multiple times?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-a-macro-be-used-to-create-a-table-and-then-filtered-multiple/m-p/802568#M315950</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to SAS programming and looking for some general guidance. I have a program where it creates the same table 4 times and has the same date filter on 3 columns for each table. The only difference is when it is filtered for specific payment types (i.e. the first time it is created it is only for reserves, then the 2nd time it is created its for paid in full, etc). My first thought to speed up the program is to create the table once, then filter it each time for specific information. Can this be done using a macro? For example, I would create macro A then call it 4 times with 4 different filters?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If a similar question has already been answered, please let me know!&lt;/P&gt;&lt;P&gt;thank you in advance!&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2022 04:54:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-a-macro-be-used-to-create-a-table-and-then-filtered-multiple/m-p/802568#M315950</guid>
      <dc:creator>BrinaLi</dc:creator>
      <dc:date>2022-03-17T04:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: Can a macro be used to create a table and then filtered multiple times?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-a-macro-be-used-to-create-a-table-and-then-filtered-multiple/m-p/802569#M315951</link>
      <description>&lt;P&gt;Use the payment types as BY or CLASS variable in your analytics procedures.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2022 07:11:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-a-macro-be-used-to-create-a-table-and-then-filtered-multiple/m-p/802569#M315951</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-03-17T07:11:21Z</dc:date>
    </item>
    <item>
      <title>Re: Can a macro be used to create a table and then filtered multiple times?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-a-macro-be-used-to-create-a-table-and-then-filtered-multiple/m-p/802572#M315952</link>
      <description>&lt;P&gt;Yes, this can be done. There are a few ways but a data set option with a WHERE statement is a good way.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, if you wanted to summarize the sashelp.class data set by sex, you could do either of the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc means data=sashelp.class (where=(sex='M'));
run;

proc means data=sashelp.class;
where sex= 'F';
run;

proc means data=sashelp.class;
class sex;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;UCLA introductory tutorial on macro variables and macros&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://stats.idre.ucla.edu/sas/seminars/sas-macros-introduction/" target="_blank"&gt;https://stats.idre.ucla.edu/sas/seminars/sas-macros-introduction/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Tutorial on converting a working program to a macro&lt;BR /&gt;&lt;BR /&gt;This method is pretty robust and helps prevent errors and makes it much easier to debug your code. Obviously biased, because I wrote it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;A href="https://github.com/statgeek/SAS-Tutorials/blob/master/Turning%20a%20program%20into%20a%20macro.md" target="_blank"&gt;https://github.com/statgeek/SAS-Tutorials/blob/master/Turning%20a%20program%20into%20a%20macro.md&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Examples of common macro usage&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/SAS-9-4-Macro-Language-Reference-Has-a-New-Appendix/ta-p/291716" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/SAS-9-4-Macro-Language-Reference-Has-a-New-Appendix/ta-p/291716&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Mar 2022 05:59:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-a-macro-be-used-to-create-a-table-and-then-filtered-multiple/m-p/802572#M315952</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-03-17T05:59:02Z</dc:date>
    </item>
  </channel>
</rss>

