<?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: Automatically Determine 15th Day After End of Quarter in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Automatically-Determine-15th-Day-After-End-of-Quarter/m-p/739824#M230973</link>
    <description>&lt;P&gt;Hi &lt;A class="trigger-hovercard" style="color: #007dc3;" href="https://communities.sas.com/t5/user/viewprofilepage/user-id/3264" target="_blank"&gt;Jeff_DOC,&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I am not quite sure what degree of "soft-coding" you expect, but here is how you can set up your binary flag (1 indicating 15th day after end of quarter) in a data step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;the_day = ( (month(run_date) in (1,4,7,10) and day(run_date)=15 );
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;the_day = ( mod(month(run_date)-1,3)=0 and day(run_date)=15 );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Does it answer your question?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="sas-author-rank"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
    <pubDate>Fri, 07 May 2021 16:09:41 GMT</pubDate>
    <dc:creator>LeonidBatkhan</dc:creator>
    <dc:date>2021-05-07T16:09:41Z</dc:date>
    <item>
      <title>Automatically Determine 15th Day After End of Quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automatically-Determine-15th-Day-After-End-of-Quarter/m-p/739807#M230960</link>
      <description>&lt;P&gt;Good morning. I would very much appreciate any help someone might give me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We have a process that runs on the 15th of each month. There is code that is contained within this process and I only want the code to run on the 15th day after the end of each quarter of the year. Our shop can set the code to run on the 15th of each month, or each day, but the code itself must check the date to determine if it is April 15th, July 15th, October 15th or January 15th and only run on those dates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Attached is the current date definition portion of the code. You can see it does determine the dates (today, current quarter, etc.). However, I guess what I need is for the code to decide if it is the 15th day after the quarter. I could accomplish it with hard coding the month or day but I was hoping someone had a better answer?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for any help someone could give me.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data params;&lt;BR /&gt;attrib &lt;BR /&gt;run_date length=8 format = mmddyy10.&lt;BR /&gt;beginqtr length=8 format = mmddyy10.&lt;BR /&gt;endingqtr length=8 format = mmddyy10. &lt;BR /&gt;rep_start_date length=$10&lt;BR /&gt;rep_end_date length=$10&lt;BR /&gt;file_name_qtr length=$6;&lt;BR /&gt;&lt;BR /&gt;run_date = today();&lt;BR /&gt;beginqtr=intnx('qtr',run_date,-1,"BEGIN");&lt;BR /&gt;endingqtr=intnx('qtr',run_date,-1,"END");&lt;BR /&gt;rep_start_date=put(beginqtr, mmddyy10.);&lt;BR /&gt;rep_end_date=put(endingqtr, mmddyy10.);&lt;BR /&gt;file_name_qtr=put(beginqtr, yyq6.);&lt;/P&gt;
&lt;P&gt;call symput("run_date",run_date);&lt;BR /&gt;call symput("beginqtr",beginqtr);&lt;BR /&gt;call symput("endingqtr",endingqtr);&lt;BR /&gt;call symput("rep_start_date",rep_start_date);&lt;BR /&gt;call symput("rep_end_date",rep_end_date);&lt;BR /&gt;call symput("file_name_qtr",file_name_qtr);&lt;BR /&gt;call symput("file_name_qtr",file_name_qtr);&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 07 May 2021 15:45:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automatically-Determine-15th-Day-After-End-of-Quarter/m-p/739807#M230960</guid>
      <dc:creator>Jeff_DOC</dc:creator>
      <dc:date>2021-05-07T15:45:57Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically Determine 15th Day After End of Quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automatically-Determine-15th-Day-After-End-of-Quarter/m-p/739812#M230964</link>
      <description>&lt;P&gt;If given todays date you want to determine the 15th day past the end of the Previous calendar quarter:&lt;/P&gt;
&lt;PRE&gt;data example;
   prevquarterplus15 = intnx('quarter',today(),-1,'e') + 15;
   format prevquarterplus15 date9.;
run;&lt;/PRE&gt;
&lt;P&gt;Once you remember that dates are number of days it is easy to add 15 to the end of the quarter, which it looks like you already have to the 15th day of the month following the end of the quarter.&lt;/P&gt;</description>
      <pubDate>Fri, 07 May 2021 15:54:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automatically-Determine-15th-Day-After-End-of-Quarter/m-p/739812#M230964</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-05-07T15:54:46Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically Determine 15th Day After End of Quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automatically-Determine-15th-Day-After-End-of-Quarter/m-p/739815#M230966</link>
      <description>&lt;P&gt;Thank you very much. It's so nice to be able to go to a group of people who know how to solve problems.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 May 2021 15:59:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automatically-Determine-15th-Day-After-End-of-Quarter/m-p/739815#M230966</guid>
      <dc:creator>Jeff_DOC</dc:creator>
      <dc:date>2021-05-07T15:59:43Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically Determine 15th Day After End of Quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automatically-Determine-15th-Day-After-End-of-Quarter/m-p/739824#M230973</link>
      <description>&lt;P&gt;Hi &lt;A class="trigger-hovercard" style="color: #007dc3;" href="https://communities.sas.com/t5/user/viewprofilepage/user-id/3264" target="_blank"&gt;Jeff_DOC,&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I am not quite sure what degree of "soft-coding" you expect, but here is how you can set up your binary flag (1 indicating 15th day after end of quarter) in a data step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;the_day = ( (month(run_date) in (1,4,7,10) and day(run_date)=15 );
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;the_day = ( mod(month(run_date)-1,3)=0 and day(run_date)=15 );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Does it answer your question?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV class="sas-author-rank"&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Fri, 07 May 2021 16:09:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automatically-Determine-15th-Day-After-End-of-Quarter/m-p/739824#M230973</guid>
      <dc:creator>LeonidBatkhan</dc:creator>
      <dc:date>2021-05-07T16:09:41Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically Determine 15th Day After End of Quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automatically-Determine-15th-Day-After-End-of-Quarter/m-p/739830#M230978</link>
      <description>&lt;P&gt;Hi Leonid.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, it does and thank you. I will also explore this option. I also look forward to reading your blog.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 May 2021 16:15:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automatically-Determine-15th-Day-After-End-of-Quarter/m-p/739830#M230978</guid>
      <dc:creator>Jeff_DOC</dc:creator>
      <dc:date>2021-05-07T16:15:36Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically Determine 15th Day After End of Quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automatically-Determine-15th-Day-After-End-of-Quarter/m-p/739835#M230982</link>
      <description>&lt;P&gt;Adding to the excellent advice above from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/51532"&gt;@LeonidBatkhan&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Turning dates into text strings and then turning those text strings into macro variables is rarely useful, in fact its almost always a waste of time. Macro variable date values should be unformatted. There are two exceptions that I know of: if you need the date in a TITLE or LABEL, and inserting data into some databases requires dates to be formatted.&lt;/P&gt;</description>
      <pubDate>Fri, 07 May 2021 16:27:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automatically-Determine-15th-Day-After-End-of-Quarter/m-p/739835#M230982</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-05-07T16:27:48Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically Determine 15th Day After End of Quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automatically-Determine-15th-Day-After-End-of-Quarter/m-p/739843#M230988</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Adding to the excellent advice above from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/51532"&gt;@LeonidBatkhan&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Turning dates into text strings and then turning those text strings into macro variables is rarely useful, in fact its almost always a waste of time. Macro variable date values should be unformatted. There are two exceptions that I know of: if you need the date in a TITLE or LABEL, and inserting data into some databases requires dates to be formatted.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Third use: External file names or paths&lt;/P&gt;</description>
      <pubDate>Fri, 07 May 2021 16:55:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automatically-Determine-15th-Day-After-End-of-Quarter/m-p/739843#M230988</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-05-07T16:55:40Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically Determine 15th Day After End of Quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automatically-Determine-15th-Day-After-End-of-Quarter/m-p/739853#M230992</link>
      <description>&lt;P&gt;Thank you for the advice. I would agree with you and it should change. The person who created it wasn't very confident they were getting the correct dates and wanted to "view" them each time to be sure. Now we have to decide what/when/how to change them to what they should be.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 May 2021 18:10:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automatically-Determine-15th-Day-After-End-of-Quarter/m-p/739853#M230992</guid>
      <dc:creator>Jeff_DOC</dc:creator>
      <dc:date>2021-05-07T18:10:05Z</dc:date>
    </item>
  </channel>
</rss>

