<?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: Need yesterdays date in format yyyy-mm-dd along with single quotes e.g. '2020-02-28' in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Need-yesterdays-date-in-format-yyyy-mm-dd-along-with-single/m-p/628764#M185856</link>
    <description>&lt;P&gt;Or, if you really want to do it entirely with the macro processor and not via CALL SYMPUTX&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let lastday = %nrstr(%')%sysfunc(PUTN(%eval(%sysfunc(date())-1),yymmdd10.))%nrstr(%');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which works but isn't particularly easy to read.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 02 Mar 2020 14:00:14 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-03-02T14:00:14Z</dc:date>
    <item>
      <title>Need yesterdays date in format yyyy-mm-dd along with single quotes e.g. '2020-02-28'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-yesterdays-date-in-format-yyyy-mm-dd-along-with-single/m-p/628714#M185826</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need yesterdays date in format yyyy-mm-dd along with single quotes e.g. '2020-02-28'.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, it should exclude saturday sunday. So if I am running job on Monday, it should take friday's date as input.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried multiple things. I am getting correct yesterdays date with below(not included sat-sun logic yet), but I need single quotes along with it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%sysfunc(PUTN(%eval(%sysfunc(date())-1),yymmdd10.))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2020 10:28:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-yesterdays-date-in-format-yyyy-mm-dd-along-with-single/m-p/628714#M185826</guid>
      <dc:creator>anagham</dc:creator>
      <dc:date>2020-03-02T10:28:43Z</dc:date>
    </item>
    <item>
      <title>Re: Need yesterdays date in format yyyy-mm-dd along with single quotes e.g. '2020-02-28'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-yesterdays-date-in-format-yyyy-mm-dd-along-with-single/m-p/628736#M185841</link>
      <description>&lt;P&gt;Try&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
   lastDay = today() - 1;
   
   call symputx('lastDay', cats("'", put(lastDay, yymmdd10.), "'"));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hint for moving "lastDay" to last Friday: the function weekday returns 1 for Sunday and 7 for Saturday,&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2020 11:37:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-yesterdays-date-in-format-yyyy-mm-dd-along-with-single/m-p/628736#M185841</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2020-03-02T11:37:25Z</dc:date>
    </item>
    <item>
      <title>Re: Need yesterdays date in format yyyy-mm-dd along with single quotes e.g. '2020-02-28'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-yesterdays-date-in-format-yyyy-mm-dd-along-with-single/m-p/628744#M185845</link>
      <description>&lt;P&gt;Via a data _null_ step.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  prev_weekdate=intnx('weekday',date(),-1);
  call symputx('mydate',cats("'",put(prev_weekdate,yymmdd10.),"'"));
  stop;
run;
%put &amp;amp;mydate;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or following your sample code as a big fat spaghetti.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put %unquote(%str(%')%sysfunc(intnx(weekday,%sysfunc(date()),-1),yymmdd10.)%str(%'));    &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2020 12:20:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-yesterdays-date-in-format-yyyy-mm-dd-along-with-single/m-p/628744#M185845</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-03-02T12:20:10Z</dc:date>
    </item>
    <item>
      <title>Re: Need yesterdays date in format yyyy-mm-dd along with single quotes e.g. '2020-02-28'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-yesterdays-date-in-format-yyyy-mm-dd-along-with-single/m-p/628760#M185852</link>
      <description>&lt;P&gt;One more solution: Let the QUOTE() function have all the fun!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
   call symputx('lastDay', quote(put(today()-1,yymmdd10.),"'"));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Mar 2020 13:49:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-yesterdays-date-in-format-yyyy-mm-dd-along-with-single/m-p/628760#M185852</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-03-02T13:49:59Z</dc:date>
    </item>
    <item>
      <title>Re: Need yesterdays date in format yyyy-mm-dd along with single quotes e.g. '2020-02-28'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-yesterdays-date-in-format-yyyy-mm-dd-along-with-single/m-p/628764#M185856</link>
      <description>&lt;P&gt;Or, if you really want to do it entirely with the macro processor and not via CALL SYMPUTX&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let lastday = %nrstr(%')%sysfunc(PUTN(%eval(%sysfunc(date())-1),yymmdd10.))%nrstr(%');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which works but isn't particularly easy to read.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Mar 2020 14:00:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-yesterdays-date-in-format-yyyy-mm-dd-along-with-single/m-p/628764#M185856</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-03-02T14:00:14Z</dc:date>
    </item>
    <item>
      <title>Re: Need yesterdays date in format yyyy-mm-dd along with single quotes e.g. '2020-02-28'</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-yesterdays-date-in-format-yyyy-mm-dd-along-with-single/m-p/629709#M186284</link>
      <description>&lt;P&gt;Thank you all for the help..It was helpful. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I will share my code which worked properly in my case.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Mar 2020 05:22:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-yesterdays-date-in-format-yyyy-mm-dd-along-with-single/m-p/629709#M186284</guid>
      <dc:creator>anagham</dc:creator>
      <dc:date>2020-03-05T05:22:21Z</dc:date>
    </item>
  </channel>
</rss>

