<?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 return yesterdays date except on a Monday return the Friday date in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/return-yesterdays-date-except-on-a-Monday-return-the-Friday-date/m-p/477261#M30991</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use the following code to select the previous days date.&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;%let DateVAR =  %sysfunc(intnx(day,%sysfunc(today()),-1),yymmddn8.);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I need to now select the previous days date for a report except when it is run on a Monday I need it to return the Fridays date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So if the report is run on Monday 9 July 2018 the date returned will be 6 July 2018.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I change this code to do this or is there different code I will need to use.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dean&lt;/P&gt;</description>
    <pubDate>Wed, 11 Jul 2018 21:59:50 GMT</pubDate>
    <dc:creator>DME790</dc:creator>
    <dc:date>2018-07-11T21:59:50Z</dc:date>
    <item>
      <title>return yesterdays date except on a Monday return the Friday date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/return-yesterdays-date-except-on-a-Monday-return-the-Friday-date/m-p/477261#M30991</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use the following code to select the previous days date.&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;%let DateVAR =  %sysfunc(intnx(day,%sysfunc(today()),-1),yymmddn8.);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I need to now select the previous days date for a report except when it is run on a Monday I need it to return the Fridays date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So if the report is run on Monday 9 July 2018 the date returned will be 6 July 2018.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I change this code to do this or is there different code I will need to use.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dean&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jul 2018 21:59:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/return-yesterdays-date-except-on-a-Monday-return-the-Friday-date/m-p/477261#M30991</guid>
      <dc:creator>DME790</dc:creator>
      <dc:date>2018-07-11T21:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: return yesterdays date except on a Monday return the Friday date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/return-yesterdays-date-except-on-a-Monday-return-the-Friday-date/m-p/477263#M30992</link>
      <description>&lt;P&gt;weekday rather than day as the interval?&lt;/P&gt;
&lt;P&gt;Or I guess if it's only Monday, use an IFN/IFC inside it?&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jul 2018 22:07:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/return-yesterdays-date-except-on-a-Monday-return-the-Friday-date/m-p/477263#M30992</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-07-11T22:07:39Z</dc:date>
    </item>
    <item>
      <title>Re: return yesterdays date except on a Monday return the Friday date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/return-yesterdays-date-except-on-a-Monday-return-the-Friday-date/m-p/477264#M30993</link>
      <description>&lt;P&gt;You can play with something like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let DateVAR = %sysfunc(today(),downame.);&lt;BR /&gt;%put &amp;amp;datevar;&lt;BR /&gt;%if &amp;amp;DateVAR=Monday %then .............more statements...;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jul 2018 22:09:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/return-yesterdays-date-except-on-a-Monday-return-the-Friday-date/m-p/477264#M30993</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-07-11T22:09:30Z</dc:date>
    </item>
    <item>
      <title>Re: return yesterdays date except on a Monday return the Friday date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/return-yesterdays-date-except-on-a-Monday-return-the-Friday-date/m-p/477266#M30994</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have never used IFC/IFN - can you show me an example or direct me to some help please.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ultimately I need to populate a Where statement like below.&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;	WHERE Date = "&amp;amp;DateVAR."d&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dean&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jul 2018 22:25:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/return-yesterdays-date-except-on-a-Monday-return-the-Friday-date/m-p/477266#M30994</guid>
      <dc:creator>DME790</dc:creator>
      <dc:date>2018-07-11T22:25:25Z</dc:date>
    </item>
    <item>
      <title>Re: return yesterdays date except on a Monday return the Friday date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/return-yesterdays-date-except-on-a-Monday-return-the-Friday-date/m-p/477269#M30995</link>
      <description>&lt;P&gt;So when the program runs on Sunday, you still want to return Saturday's date (not Friday)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's much easier to follow if you use a DATA step and get rid of %SYSFUNC.&amp;nbsp; It could look like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;/P&gt;
&lt;P&gt;datevar = today() - 1;&lt;/P&gt;
&lt;P&gt;if weekday(datevar) = 1 then datevar = datevar - 2;&lt;/P&gt;
&lt;P&gt;call symputx('datevar', put(datevar, yymmddn8.));&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jul 2018 22:51:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/return-yesterdays-date-except-on-a-Monday-return-the-Friday-date/m-p/477269#M30995</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-07-11T22:51:49Z</dc:date>
    </item>
    <item>
      <title>Re: return yesterdays date except on a Monday return the Friday date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/return-yesterdays-date-except-on-a-Monday-return-the-Friday-date/m-p/477272#M30996</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The report is for weekdays only so don't want to return Saturdays or Sundays - am I right if I change the code to the below to remove Saturdays as well?&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;data _null_;
datevar = today() - 1;
if weekday(datevar) = 1 then datevar = datevar - 2;
else if weekday(datevar) = 7 then datevar = datevar - 1;
call symputx('datevar', put(datevar, yymmddn8.));
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dean&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jul 2018 23:06:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/return-yesterdays-date-except-on-a-Monday-return-the-Friday-date/m-p/477272#M30996</guid>
      <dc:creator>DME790</dc:creator>
      <dc:date>2018-07-11T23:06:27Z</dc:date>
    </item>
    <item>
      <title>Re: return yesterdays date except on a Monday return the Friday date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/return-yesterdays-date-except-on-a-Monday-return-the-Friday-date/m-p/477273#M30997</link>
      <description>&lt;P&gt;You get 100%.&lt;/P&gt;</description>
      <pubDate>Wed, 11 Jul 2018 23:13:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/return-yesterdays-date-except-on-a-Monday-return-the-Friday-date/m-p/477273#M30997</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-07-11T23:13:49Z</dc:date>
    </item>
    <item>
      <title>Re: return yesterdays date except on a Monday return the Friday date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/return-yesterdays-date-except-on-a-Monday-return-the-Friday-date/m-p/477613#M31014</link>
      <description>&lt;P&gt;You can try this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &lt;STRONG&gt;&lt;I&gt;dtx&lt;/I&gt;&lt;/STRONG&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%global&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; rptdt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%if&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%eval&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%sysfunc&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(weekday(&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%sysfunc&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(today()))))=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;2&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%then&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; rptdt = &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%sysfunc&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(intnx(weekday, &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%sysfunc&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(today()), -1), mmddyy10.); &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%else&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%let&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; rptdt = &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%sysfunc&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(intnx(day, &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%sysfunc&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;(today()), -1), mmddyy10.); &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; dtx;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;dtx&lt;/I&gt;&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%put&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &amp;amp;rptdt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jul 2018 17:01:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/return-yesterdays-date-except-on-a-Monday-return-the-Friday-date/m-p/477613#M31014</guid>
      <dc:creator>EEng</dc:creator>
      <dc:date>2018-07-12T17:01:44Z</dc:date>
    </item>
    <item>
      <title>Re: return yesterdays date except on a Monday return the Friday date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/return-yesterdays-date-except-on-a-Monday-return-the-Friday-date/m-p/477616#M31015</link>
      <description>I just saw that you don't want Sat &amp;amp; Sun. Then this all you need:&lt;BR /&gt;%let rptdt = %sysfunc(intnx(weekday, %sysfunc(today()), -1), mmddyy10.);</description>
      <pubDate>Thu, 12 Jul 2018 17:04:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/return-yesterdays-date-except-on-a-Monday-return-the-Friday-date/m-p/477616#M31015</guid>
      <dc:creator>EEng</dc:creator>
      <dc:date>2018-07-12T17:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: return yesterdays date except on a Monday return the Friday date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/return-yesterdays-date-except-on-a-Monday-return-the-Friday-date/m-p/477631#M31016</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/220719"&gt;@EEng&lt;/a&gt;&amp;nbsp;Yes, if s/he wants only weekdays then the weekday is a better approach. It was the first suggestion s/he received as well, so I'm guessing that's not what they want.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jul 2018 17:38:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/return-yesterdays-date-except-on-a-Monday-return-the-Friday-date/m-p/477631#M31016</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-07-12T17:38:12Z</dc:date>
    </item>
    <item>
      <title>Re: return yesterdays date except on a Monday return the Friday date</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/return-yesterdays-date-except-on-a-Monday-return-the-Friday-date/m-p/477698#M31017</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Apologies as I didn't read your response properly&amp;nbsp; - I thought that was a question - now I know what you meant, replace day with weekday.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I should have known better as your responses to queries are always very helpful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dean&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jul 2018 22:14:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/return-yesterdays-date-except-on-a-Monday-return-the-Friday-date/m-p/477698#M31017</guid>
      <dc:creator>DME790</dc:creator>
      <dc:date>2018-07-12T22:14:08Z</dc:date>
    </item>
  </channel>
</rss>

