<?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 month per month and day per day in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/macro-month-per-month-and-day-per-day/m-p/762659#M241488</link>
    <description>&lt;P&gt;Is your date_SUIV list &lt;STRONG&gt;always all&lt;/STRONG&gt; days in the month separated by pipes, or are specific days included?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some generic references for now are below, But using CALL EXECUTE or a macro loop will work for this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;UCLA introductory tutorial on macro variables and macros&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;&lt;STRONG&gt;Tutorial on converting a working program to a macro&lt;/STRONG&gt;&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;&lt;STRONG&gt;Examples of common macro usage - see the example on looping with dates which would allow you to loop through the dates.&lt;/STRONG&gt;&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;</description>
    <pubDate>Thu, 19 Aug 2021 19:27:26 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2021-08-19T19:27:26Z</dc:date>
    <item>
      <title>macro month per month and day per day</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-month-per-month-and-day-per-day/m-p/762656#M241487</link>
      <description>&lt;P&gt;Hi everyone,&lt;BR /&gt;I have an issue,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a macro :&amp;nbsp;&lt;CODE class=" language-sas"&gt;Calcul_Defaut_Acheteur_New &lt;/CODE&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;who scan day per day a SAS file, keep only specific lines, and at the end save these specifics lines in a unique SAS file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And for example, to run the macro, I have to do this (date_bal correspond to the month and date_suiv correspond to the whole day in a month )&amp;nbsp; :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let date_suiv=20190101|20190102|20190103|20190104|20190105|20190106|20190107|20190108|20190109|20190110|20190111|20190112|20190113|20190114|20190115|20190116|20190117|20190118|20190119|20190120|20190121|20190122|20190123|20190124|20190125|20190126|20190127|20190128|20190129|20190130|20190131;
%let date_bal=20190131; /*january 2019*/

%Calcul_Defaut_Acheteur_New(date=&amp;amp;date_suiv,Per_B2=&amp;amp;date_bal);

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But I would like to execute my macro for the whole year.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So instead of doing this :&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let date_suiv=20190101|20190102|20190103|20190104|20190105|20190106|20190107|20190108|20190109|20190110|20190111|20190112|20190113|20190114|20190115|20190116|20190117|20190118|20190119|20190120|20190121|20190122|20190123|20190124|20190125|20190126|20190127|20190128|20190129|20190130|20190131;
%let date_bal=20190131; /*january 2019*/

%Calcul_Defaut_Acheteur_New(date=&amp;amp;date_suiv,Per_B2=&amp;amp;date_bal);


%let date_suiv=20190201|20190202|20190203|20190204|20190205|20190206|20190207|20190208|20190209|20190210|20190211|20190212|20190213|20190214|20190215|20190216|20190217|20190218|20190219|20190220|20190221|20190222|20190223|20190224|20190225|20190226|20190227|20190228;
%let date_bal=20190231; /*february 2019*/

%Calcul_Defaut_Acheteur_New(date=&amp;amp;date_suiv,Per_B2=&amp;amp;date_bal);

/*
etc
*/

%let date_suiv=20191201|20191202|20191203|20191204|20191205|20191206|20191207|20191208|20191209|20191210|20191211|20191212|20191213|20191214|20191215|20191216|20191217|20191218|20191219|20191220|20191221|20191222|20191223|20191224|20191225|20191226|20191227|20191228|20191229|20191230|20191231;
%let date_bal=20191231; /* december 2019*/

%Calcul_Defaut_Acheteur_New(date=&amp;amp;date_suiv,Per_B2=&amp;amp;date_bal);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I thought to do a macro in my macro but I have no idea how to do it.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Someone know how to do ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Aug 2021 19:21:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-month-per-month-and-day-per-day/m-p/762656#M241487</guid>
      <dc:creator>unifly</dc:creator>
      <dc:date>2021-08-19T19:21:52Z</dc:date>
    </item>
    <item>
      <title>Re: macro month per month and day per day</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-month-per-month-and-day-per-day/m-p/762659#M241488</link>
      <description>&lt;P&gt;Is your date_SUIV list &lt;STRONG&gt;always all&lt;/STRONG&gt; days in the month separated by pipes, or are specific days included?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some generic references for now are below, But using CALL EXECUTE or a macro loop will work for this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;UCLA introductory tutorial on macro variables and macros&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;&lt;STRONG&gt;Tutorial on converting a working program to a macro&lt;/STRONG&gt;&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;&lt;STRONG&gt;Examples of common macro usage - see the example on looping with dates which would allow you to loop through the dates.&lt;/STRONG&gt;&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;</description>
      <pubDate>Thu, 19 Aug 2021 19:27:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-month-per-month-and-day-per-day/m-p/762659#M241488</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-08-19T19:27:26Z</dc:date>
    </item>
  </channel>
</rss>

