<?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: Can I convert a SAS date to a SAS date constant? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Can-I-convert-a-SAS-date-to-a-SAS-date-constant/m-p/457288#M115925</link>
    <description>The interpreter only understands '21apr2018'd as legit input not 21295.</description>
    <pubDate>Wed, 25 Apr 2018 13:58:10 GMT</pubDate>
    <dc:creator>Jakob_midspar</dc:creator>
    <dc:date>2018-04-25T13:58:10Z</dc:date>
    <item>
      <title>Can I convert a SAS date to a SAS date constant?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-convert-a-SAS-date-to-a-SAS-date-constant/m-p/457260#M115910</link>
      <description>&lt;P&gt;Hi Community&lt;/P&gt;&lt;P&gt;I'm in need of a function or a format that can help me convert a SAS date to a SAS date constant.&lt;/P&gt;&lt;P&gt;What I have is a variable containing a SAS date e.g. 21295, (21. of April 2018), what I need is to convert the SAS date to a SAS date constant i.e. '21apr2018'd.&lt;/P&gt;&lt;P&gt;How can I do this without choosing a date9. format for the SAS date and concatenating it with ''d?&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Jakob&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 13:20:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-convert-a-SAS-date-to-a-SAS-date-constant/m-p/457260#M115910</guid>
      <dc:creator>Jakob_midspar</dc:creator>
      <dc:date>2018-04-25T13:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: Can I convert a SAS date to a SAS date constant?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-convert-a-SAS-date-to-a-SAS-date-constant/m-p/457270#M115913</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/17199"&gt;@Jakob_midspar&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi Community&lt;/P&gt;
&lt;P&gt;I'm in need of a function or a format that can help me convert a SAS date to a SAS date constant.&lt;/P&gt;
&lt;P&gt;What I have is a variable containing a SAS date e.g. 21295, (21. of April 2018), what I need is to convert the SAS date to a SAS date constant i.e. '21apr2018'd.&lt;/P&gt;
&lt;P&gt;How can I do this without choosing a date9. format for the SAS date and concatenating it with ''d?&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;Jakob&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;From my experience, you never need to convert. 21295 can be used in any place where you'd use '21apr2018'd.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And you always need to apply the date9 format, quotes, and the letter d to do this "conversion".&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 13:34:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-convert-a-SAS-date-to-a-SAS-date-constant/m-p/457270#M115913</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-04-25T13:34:44Z</dc:date>
    </item>
    <item>
      <title>Re: Can I convert a SAS date to a SAS date constant?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-convert-a-SAS-date-to-a-SAS-date-constant/m-p/457272#M115914</link>
      <description>&lt;P&gt;Hi Jacob,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am by no means an expert! However, you might find this link helpful:&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000199367.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000199367.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 13:35:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-convert-a-SAS-date-to-a-SAS-date-constant/m-p/457272#M115914</guid>
      <dc:creator>NewSASuser2018</dc:creator>
      <dc:date>2018-04-25T13:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: Can I convert a SAS date to a SAS date constant?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-convert-a-SAS-date-to-a-SAS-date-constant/m-p/457275#M115917</link>
      <description>&lt;P&gt;Could you clarify why?&amp;nbsp; Date literals are only really used to get date text which is not in data into SAS code.&amp;nbsp; There really isn't much purpose in it for any other circumstance?&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 13:40:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-convert-a-SAS-date-to-a-SAS-date-constant/m-p/457275#M115917</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-25T13:40:09Z</dc:date>
    </item>
    <item>
      <title>Re: Can I convert a SAS date to a SAS date constant?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-convert-a-SAS-date-to-a-SAS-date-constant/m-p/457279#M115919</link>
      <description>&lt;P&gt;Sure, I can try and clarify as to why I need that SAS date constant instead of simply the SAS date.&lt;/P&gt;&lt;P&gt;I'm getting data from a Teradata source using an ODBC connection and apparently the interpreter can only translate a SAS date constant to Teradata and not the SAS date itself, beats me why!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 13:46:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-convert-a-SAS-date-to-a-SAS-date-constant/m-p/457279#M115919</guid>
      <dc:creator>Jakob_midspar</dc:creator>
      <dc:date>2018-04-25T13:46:23Z</dc:date>
    </item>
    <item>
      <title>Re: Can I convert a SAS date to a SAS date constant?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-convert-a-SAS-date-to-a-SAS-date-constant/m-p/457281#M115921</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data DateValue;
format dat date9. ;
	dat=21295;
	xdat=put(dat, date9.);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;once in character format. you can use it as variable or contant&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 13:46:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-convert-a-SAS-date-to-a-SAS-date-constant/m-p/457281#M115921</guid>
      <dc:creator>emrancaan</dc:creator>
      <dc:date>2018-04-25T13:46:45Z</dc:date>
    </item>
    <item>
      <title>Re: Can I convert a SAS date to a SAS date constant?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-convert-a-SAS-date-to-a-SAS-date-constant/m-p/457282#M115922</link>
      <description>That's how far I've gotten myself - but still needs the gnyffs and the d ( '21apr2018'd ) for it to be recognized as a SAS date constant.</description>
      <pubDate>Wed, 25 Apr 2018 13:51:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-convert-a-SAS-date-to-a-SAS-date-constant/m-p/457282#M115922</guid>
      <dc:creator>Jakob_midspar</dc:creator>
      <dc:date>2018-04-25T13:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: Can I convert a SAS date to a SAS date constant?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-convert-a-SAS-date-to-a-SAS-date-constant/m-p/457286#M115924</link>
      <description>&lt;P&gt;Not heard that before.&amp;nbsp; I think you probably mean dates in YYYY-MM-DD format, not SAS date literal, just a guess there.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So when passing through SQL, you need to have the code in such a way that the database understands it, not SAS, as it is effectively all being passed over to the database.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 13:55:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-convert-a-SAS-date-to-a-SAS-date-constant/m-p/457286#M115924</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-04-25T13:55:13Z</dc:date>
    </item>
    <item>
      <title>Re: Can I convert a SAS date to a SAS date constant?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-convert-a-SAS-date-to-a-SAS-date-constant/m-p/457288#M115925</link>
      <description>The interpreter only understands '21apr2018'd as legit input not 21295.</description>
      <pubDate>Wed, 25 Apr 2018 13:58:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-convert-a-SAS-date-to-a-SAS-date-constant/m-p/457288#M115925</guid>
      <dc:creator>Jakob_midspar</dc:creator>
      <dc:date>2018-04-25T13:58:10Z</dc:date>
    </item>
    <item>
      <title>Re: Can I convert a SAS date to a SAS date constant?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-convert-a-SAS-date-to-a-SAS-date-constant/m-p/457298#M115930</link>
      <description>&lt;P&gt;How can I do this without choosing a date9. format for the SAS date and concatenating it with ''d?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why would&amp;nbsp; you rule that out?&amp;nbsp; It's exactly what you need.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If double quotes are permissible:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;sdc = quote(put(date,date9.)) || 'd';&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If single quotes are required:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;sdc = cats("'", put(date, date9.), "'d");&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 14:13:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-convert-a-SAS-date-to-a-SAS-date-constant/m-p/457298#M115930</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-04-25T14:13:11Z</dc:date>
    </item>
    <item>
      <title>Re: Can I convert a SAS date to a SAS date constant?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-I-convert-a-SAS-date-to-a-SAS-date-constant/m-p/457643#M116043</link>
      <description>Great solution, thanks for your input.&lt;BR /&gt;Cheers,&lt;BR /&gt;Jakob</description>
      <pubDate>Thu, 26 Apr 2018 09:21:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-I-convert-a-SAS-date-to-a-SAS-date-constant/m-p/457643#M116043</guid>
      <dc:creator>Jakob_midspar</dc:creator>
      <dc:date>2018-04-26T09:21:24Z</dc:date>
    </item>
  </channel>
</rss>

