<?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: yesterday's date Char format in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/yesterday-s-date-Char-format/m-p/145575#M38758</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can't think of an easy way to single quote it except catenating them in (or translate after the double quote):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; call symputx('beg', cats("'",put(date()-45,yymmdd10.),"'"));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%put &amp;amp;beg;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 15 Nov 2013 19:07:19 GMT</pubDate>
    <dc:creator>Haikuo</dc:creator>
    <dc:date>2013-11-15T19:07:19Z</dc:date>
    <item>
      <title>yesterday's date Char format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/yesterday-s-date-Char-format/m-p/145570#M38753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to write a program that pulls data from a SQL server for the last 45 days.&amp;nbsp; The format on the SQL server for the date is a datetime format. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;I have this so far:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;%let BEG = '2013-10-01';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;%put &amp;amp;BEG;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;%let END = '2013-11-14';&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;%put &amp;amp;END;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;proc sql;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;....where date between &amp;amp;BEG and &amp;amp;END...;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: arial,helvetica,sans-serif;"&gt;The above code works, but I would love to have something that automatically fills in yesterday's date and 45 days prior.&amp;nbsp; I tried this :&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 11pt;"&gt;%let &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;BEG = &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 11pt;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;(PUTN(&lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 11pt;"&gt;%eval&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 11pt;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;(date())-45),yymmdd10.));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 11pt;"&gt;%put &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;&amp;amp;BEG;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 11pt;"&gt;%let &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;END = &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 11pt;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;(PUTN(&lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 11pt;"&gt;%eval&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 11pt;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;(date())-1),yymmdd10.));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 11pt;"&gt;%put &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;&amp;amp;END;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: arial,helvetica,sans-serif; font-size: 11pt;"&gt;This almost works.&amp;nbsp; It outputs 2013-10-01 and 2013-11-14, but I need it to output '2013-10-01' and '2013-11-14' so that my where statement evaluates correctly.&amp;nbsp; Is that possible?&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: arial,helvetica,sans-serif; font-size: 11pt;"&gt;Thanks for all of your help.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Nov 2013 17:29:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/yesterday-s-date-Char-format/m-p/145570#M38753</guid>
      <dc:creator>ewhulbert</dc:creator>
      <dc:date>2013-11-15T17:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: yesterday's date Char format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/yesterday-s-date-Char-format/m-p/145571#M38754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why not leave it as a number rather than try and format it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 11pt;"&gt;%let &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;BEG =&lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 11pt;"&gt;%eval&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 11pt;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;(date())-45);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 11pt;"&gt;%let &lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;END = &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 11pt;"&gt;%eval&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New'; font-size: 11pt;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;(date())-1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;The query will convert it appropriately, though it won't display as a date (2013-10-01). &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New'; font-size: 11pt;"&gt;But if your date in SQL server is datetime you may a different type of calculation depending on how you're extracting your data.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Nov 2013 17:46:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/yesterday-s-date-Char-format/m-p/145571#M38754</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-11-15T17:46:00Z</dc:date>
    </item>
    <item>
      <title>Re: yesterday's date Char format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/yesterday-s-date-Char-format/m-p/145572#M38755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The SQL server that I am pulling it from has the information formatted as date time, but there is no time entered.&amp;nbsp; It looks like this 2013-11-14 00:00:00.000.&amp;nbsp; Selecting it by using '2013-11-14' works, but using SAS dates like 19362 does not.&amp;nbsp; I am trying to get from the system yesterday's date and 45 days ago's date, in yymmdd10. format, but with quotes around it like '2013-11-14'. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Nov 2013 18:21:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/yesterday-s-date-Char-format/m-p/145572#M38755</guid>
      <dc:creator>ewhulbert</dc:creator>
      <dc:date>2013-11-15T18:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: yesterday's date Char format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/yesterday-s-date-Char-format/m-p/145573#M38756</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try using a %sysfunc(quote(&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;(PUTN(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;%eval&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;(date())-45),yymmdd10.)));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Nov 2013 18:46:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/yesterday-s-date-Char-format/m-p/145573#M38756</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2013-11-15T18:46:05Z</dc:date>
    </item>
    <item>
      <title>Re: yesterday's date Char format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/yesterday-s-date-Char-format/m-p/145574#M38757</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So Close!&amp;nbsp; I thought this would work, but this puts out double quotes e.g. "2013-11-14" instead of single '2013-11-14', and apparently it does not like the doube quotes. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Great idea, do you know of a way to do it with single quotes?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Nov 2013 18:53:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/yesterday-s-date-Char-format/m-p/145574#M38757</guid>
      <dc:creator>ewhulbert</dc:creator>
      <dc:date>2013-11-15T18:53:28Z</dc:date>
    </item>
    <item>
      <title>Re: yesterday's date Char format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/yesterday-s-date-Char-format/m-p/145575#M38758</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can't think of an easy way to single quote it except catenating them in (or translate after the double quote):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; call symputx('beg', cats("'",put(date()-45,yymmdd10.),"'"));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%put &amp;amp;beg;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Nov 2013 19:07:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/yesterday-s-date-Char-format/m-p/145575#M38758</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2013-11-15T19:07:19Z</dc:date>
    </item>
    <item>
      <title>Re: yesterday's date Char format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/yesterday-s-date-Char-format/m-p/145576#M38759</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, you helped me again!&amp;nbsp; Your solution worked perfectly.&amp;nbsp; Let me know if you are ever in Jax, I owe you a couple beers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On a side note, I am not sure why this doesnt work: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt; BEG = &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 12pt; font-family: Courier New;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;(PUTN(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 12pt; font-family: Courier New;"&gt;%eval&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 12pt; font-family: Courier New;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;(date())-45), yymmdd10.));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 12pt; font-family: Courier New;"&gt;%unquote&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 12pt; font-family: Courier New;"&gt;%str&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;(%')&amp;amp;BEG&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 12pt; font-family: Courier New;"&gt;%str&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;(%'));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt; END = &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 12pt; font-family: Courier New;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;(PUTN(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 12pt; font-family: Courier New;"&gt;%eval&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 12pt; font-family: Courier New;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;(date())-1), yymmdd10.));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 12pt; font-family: Courier New;"&gt;%unquote&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 12pt; font-family: Courier New;"&gt;%str&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;(%')&amp;amp;END&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 12pt; font-family: Courier New;"&gt;%str&lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;(%'));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It outputs what I want, but the Proc SQL is unable to get the information with it.&amp;nbsp; Oh well, i think the Hai.kuo's cats solution is more straightforward anyways, and I will use it in the future. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Nov 2013 19:28:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/yesterday-s-date-Char-format/m-p/145576#M38759</guid>
      <dc:creator>ewhulbert</dc:creator>
      <dc:date>2013-11-15T19:28:38Z</dc:date>
    </item>
    <item>
      <title>Re: yesterday's date Char format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/yesterday-s-date-Char-format/m-p/145577#M38760</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;LOL. Thanks for the offer. Haven't been there for more than 5 years. Nice town.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Nov 2013 19:51:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/yesterday-s-date-Char-format/m-p/145577#M38760</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2013-11-15T19:51:34Z</dc:date>
    </item>
  </channel>
</rss>

