<?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 Using macro date range in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Using-macro-date-range/m-p/134108#M36393</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table pay1 as&lt;/P&gt;&lt;P&gt;select id, due_date&lt;/P&gt;&lt;P&gt;from table1&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data pay2;&lt;/P&gt;&lt;P&gt;set pay1;&lt;/P&gt;&lt;P&gt;BreakDate=due_date+5 /*Example if the due_date is 05/25/2013 this variable returns 05/30/13*/&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;My question is, I use macro that automatically accounts for previous business day.&amp;nbsp; If a day falls on Sunday, the macro &amp;amp;pbd will assign a Monday date.&amp;nbsp; For example &amp;amp;pbd+5 will return an number value for 5 days after the previous business day.&amp;nbsp; I then can format it to look like an actual date.&lt;/P&gt;&lt;P&gt;I need to incorporate due_date and &amp;amp;pbd together to produce the next business days after the 5 days has elapsed.&amp;nbsp; For example if I use the formula in my program:&lt;/P&gt;&lt;P&gt;If the due_date=05/14/13,the BreakDate will equal 5/19/13, which is Sunday.&amp;nbsp; I want to default to Monday.&amp;nbsp; I need to use both the due_date and &amp;amp;pbd to accomplish this.&amp;nbsp; Or is there an easier way?&amp;nbsp; Perhaps just say if the BreakDate falls on Sunday, automatically increment to Monday?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 May 2013 18:46:51 GMT</pubDate>
    <dc:creator>omega1983</dc:creator>
    <dc:date>2013-05-14T18:46:51Z</dc:date>
    <item>
      <title>Using macro date range</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-macro-date-range/m-p/134108#M36393</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;create table pay1 as&lt;/P&gt;&lt;P&gt;select id, due_date&lt;/P&gt;&lt;P&gt;from table1&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data pay2;&lt;/P&gt;&lt;P&gt;set pay1;&lt;/P&gt;&lt;P&gt;BreakDate=due_date+5 /*Example if the due_date is 05/25/2013 this variable returns 05/30/13*/&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;My question is, I use macro that automatically accounts for previous business day.&amp;nbsp; If a day falls on Sunday, the macro &amp;amp;pbd will assign a Monday date.&amp;nbsp; For example &amp;amp;pbd+5 will return an number value for 5 days after the previous business day.&amp;nbsp; I then can format it to look like an actual date.&lt;/P&gt;&lt;P&gt;I need to incorporate due_date and &amp;amp;pbd together to produce the next business days after the 5 days has elapsed.&amp;nbsp; For example if I use the formula in my program:&lt;/P&gt;&lt;P&gt;If the due_date=05/14/13,the BreakDate will equal 5/19/13, which is Sunday.&amp;nbsp; I want to default to Monday.&amp;nbsp; I need to use both the due_date and &amp;amp;pbd to accomplish this.&amp;nbsp; Or is there an easier way?&amp;nbsp; Perhaps just say if the BreakDate falls on Sunday, automatically increment to Monday?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2013 18:46:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-macro-date-range/m-p/134108#M36393</guid>
      <dc:creator>omega1983</dc:creator>
      <dc:date>2013-05-14T18:46:51Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro date range</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-macro-date-range/m-p/134109#M36394</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use intnx with the 'weekday' option. But this won't account for holidays, so if yours does then its better.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;intnx('weekday', '14May2013'd, 5);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2013 19:00:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-macro-date-range/m-p/134109#M36394</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-05-14T19:00:46Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro date range</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-macro-date-range/m-p/134110#M36395</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;how about the last logic,&lt;/P&gt;&lt;P&gt;If the Breakdate falls on Sunday, automatically increment to Monday.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;break_date='19may2013'd;&lt;/P&gt;&lt;P&gt;if weekday(break_date)=1 then break_date=break_date+1;&lt;/P&gt;&lt;P&gt;put break_date date9.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 May 2013 19:32:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-macro-date-range/m-p/134110#M36395</guid>
      <dc:creator>Arul</dc:creator>
      <dc:date>2013-05-14T19:32:41Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro date range</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-macro-date-range/m-p/134111#M36396</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi ,&lt;/P&gt;&lt;P&gt;Try this..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want (drop =i);&lt;BR /&gt;informat break_date date9.;&lt;BR /&gt;format&amp;nbsp; break_date date9.;&lt;BR /&gt;do i = 1 to (3*30);&lt;BR /&gt;Break_date=intnx('days','01Apr2013'd,i);&lt;BR /&gt;if weekday(break_date) = 1 then&lt;BR /&gt;break_date=intnx('days',break_date,1);&lt;/P&gt;&lt;P&gt;output;&lt;/P&gt;&lt;P&gt;i=i+4;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Allu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 May 2013 04:23:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-macro-date-range/m-p/134111#M36396</guid>
      <dc:creator>allurai0412</dc:creator>
      <dc:date>2013-05-15T04:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro date range</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-macro-date-range/m-p/134112#M36397</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;It is simple by using DATA Step as follow...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;data test(drop = _temp);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; format due_date break_date date9.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; due_date = "01Jan2013"d;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; break_date = due_date + 5;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; _temp = weekday(break_date);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; if _temp = 1 then do;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break_date = due_date + 6;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; else do;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; break_date = break_date;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;-Urvish&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 May 2013 08:50:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-macro-date-range/m-p/134112#M36397</guid>
      <dc:creator>UrvishShah</dc:creator>
      <dc:date>2013-05-15T08:50:34Z</dc:date>
    </item>
    <item>
      <title>Re: Using macro date range</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Using-macro-date-range/m-p/134113#M36398</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is in the macro variable &amp;amp;BPD ?&lt;/P&gt;&lt;P&gt;1) How is it formatted?&amp;nbsp; If it is formatted as DATE9. format outputs data then you can use it as a date literal in your SQL statements. For Example:&amp;nbsp; if break_date= "&amp;amp;BPD"d.&lt;/P&gt;&lt;P&gt;2) What does the value of BPD represent?&amp;nbsp; Is it one number that will apply to all observations?&amp;nbsp; If not then you need a way to get the value of BPD that is right for the current observation.&amp;nbsp; Perhaps by creating a separate table you can merge onto your data? Or a format?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 May 2013 13:33:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Using-macro-date-range/m-p/134113#M36398</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-05-15T13:33:15Z</dc:date>
    </item>
  </channel>
</rss>

