<?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 Time stamp format help in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Time-stamp-format-help/m-p/79851#M17207</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I have a Terdata table which has field created_on with timestamp(0) format of Teradata.&lt;/P&gt;&lt;P&gt;I need to select rows from table using my DI Job.. however I am unable to find equivalent SAS format.&lt;/P&gt;&lt;P&gt;E.G.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My entry in TD table is sel * from tab where created_on&amp;lt;='2013-09-12 12:00:00' ---------&amp;gt; This works&lt;/P&gt;&lt;P&gt;In DI JOb's precode , I am writing&lt;/P&gt;&lt;P&gt;%let bus_time=%sysfunc(datetime(),DATETIME23.3);&lt;/P&gt;&lt;P&gt;%let bus_time_f=%unquote(%bquote(')&amp;amp;bus_time%bquote('));&lt;/P&gt;&lt;P&gt;and then selecting in my SQL join as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sel * from tab where created_on&amp;lt;=&amp;amp;bus_time_f--------&amp;gt; This doesnt work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;bus_time_f&amp;nbsp; resolves to '12SEP2013:20:54:14.087'&amp;nbsp;&amp;nbsp; ......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Need some assistance in getting correct format. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Sep 2013 11:01:14 GMT</pubDate>
    <dc:creator>forumsguy</dc:creator>
    <dc:date>2013-09-12T11:01:14Z</dc:date>
    <item>
      <title>Time stamp format help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Time-stamp-format-help/m-p/79851#M17207</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I have a Terdata table which has field created_on with timestamp(0) format of Teradata.&lt;/P&gt;&lt;P&gt;I need to select rows from table using my DI Job.. however I am unable to find equivalent SAS format.&lt;/P&gt;&lt;P&gt;E.G.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My entry in TD table is sel * from tab where created_on&amp;lt;='2013-09-12 12:00:00' ---------&amp;gt; This works&lt;/P&gt;&lt;P&gt;In DI JOb's precode , I am writing&lt;/P&gt;&lt;P&gt;%let bus_time=%sysfunc(datetime(),DATETIME23.3);&lt;/P&gt;&lt;P&gt;%let bus_time_f=%unquote(%bquote(')&amp;amp;bus_time%bquote('));&lt;/P&gt;&lt;P&gt;and then selecting in my SQL join as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sel * from tab where created_on&amp;lt;=&amp;amp;bus_time_f--------&amp;gt; This doesnt work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;bus_time_f&amp;nbsp; resolves to '12SEP2013:20:54:14.087'&amp;nbsp;&amp;nbsp; ......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Need some assistance in getting correct format. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Sep 2013 11:01:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Time-stamp-format-help/m-p/79851#M17207</guid>
      <dc:creator>forumsguy</dc:creator>
      <dc:date>2013-09-12T11:01:14Z</dc:date>
    </item>
    <item>
      <title>Re: Time stamp format help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Time-stamp-format-help/m-p/79852#M17208</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ForumsGuy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have no experience with the DB to which you refer, so I am not sure if the following will help, but you could use a picture format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC FORMAT ;&lt;/P&gt;&lt;P&gt;PICTURE TERDATE LOW-HIGH = '%Y-%0m-%0d:%0H:%0M:%0S'&lt;/P&gt;&lt;P&gt;(DATATYPE = DATETIME) ;&lt;/P&gt;&lt;P&gt;RUN ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%LET BUS_TIME=%SYSFUNC(INPUTN(%SYSFUNC(DATETIME()),TERDATE.));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%put&amp;nbsp; &amp;amp;BUS_TIME.;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Sep 2013 11:22:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Time-stamp-format-help/m-p/79852#M17208</guid>
      <dc:creator>Scott_Mitchell</dc:creator>
      <dc:date>2013-09-12T11:22:28Z</dc:date>
    </item>
    <item>
      <title>Re: Time stamp format help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Time-stamp-format-help/m-p/79853#M17209</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG style="color: #3366ff; font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;You can try this also ...! &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: courier new,courier;"&gt;%LET VAL = %SUBSTR(%SYSFUNC(DATETIME(),DATETIME23),1,9);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #000000; font-family: courier new,courier;"&gt;%LET BUS_DATE = %SYSFUNC(INPUTN(&amp;amp;VAL,DATE9.),YYMMDD10.);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #000000; font-family: courier new,courier;"&gt;%LET BUS_TIME=%SUBSTR(%SYSFUNC(DATETIME(),DATETIME23),11,8);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #000000; font-family: courier new,courier;"&gt;%LET BUS_TIME_F=%UNQUOTE(%BQUOTE(')&amp;amp;BUS_DATE:&amp;amp;BUS_TIME%BQUOTE('));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: courier new,courier;"&gt;%PUT #### &amp;amp;VAL #### ;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #000000; font-family: courier new,courier;"&gt;%PUT #### &amp;amp;BUS_DATE #### ;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #000000; font-family: courier new,courier;"&gt;%PUT #### &amp;amp;BUS_TIME #### ;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #000000; font-family: courier new,courier;"&gt;%PUT #### &amp;amp;BUS_TIME_F #### ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #3366ff; font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;Use the variable BUS_TIME_F in your code.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;Thanks&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff;"&gt;&lt;STRONG style="font-size: 12pt; font-family: calibri, verdana, arial, sans-serif;"&gt;Dhana&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Sep 2013 12:19:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Time-stamp-format-help/m-p/79853#M17209</guid>
      <dc:creator>dhana</dc:creator>
      <dc:date>2013-09-12T12:19:11Z</dc:date>
    </item>
    <item>
      <title>Re: Time stamp format help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Time-stamp-format-help/m-p/79854#M17210</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is the format of &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt; &lt;/SPAN&gt;CREATED_ON variable?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Sep 2013 13:51:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Time-stamp-format-help/m-p/79854#M17210</guid>
      <dc:creator>sandyming</dc:creator>
      <dc:date>2013-09-12T13:51:14Z</dc:date>
    </item>
    <item>
      <title>Re: Time stamp format help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Time-stamp-format-help/m-p/79855#M17211</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Amazing.. Both of these worked.. Thanks Dhana and Scott&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Sep 2013 02:10:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Time-stamp-format-help/m-p/79855#M17211</guid>
      <dc:creator>forumsguy</dc:creator>
      <dc:date>2013-09-13T02:10:32Z</dc:date>
    </item>
    <item>
      <title>Re: Time stamp format help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Time-stamp-format-help/m-p/79856#M17212</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can tell Teradata how to interpret the string you have given it.&lt;/P&gt;&lt;P&gt;In SAS generate the string in normal DATETIME format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%let bus_time=%sysfunc(datetime(),DATETIME19.);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%let bus_time_f=%unquote(%bquote(')&amp;amp;bus_time%bquote('));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;In Teradata tell what format to use to read that format.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="line-height: 1.5em; font-size: 10pt; font-family: 'courier new', courier;"&gt;sel * &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="line-height: 1.5em; font-size: 10pt; font-family: 'courier new', courier;"&gt;from tab &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;where created_on &amp;lt;= &amp;amp;bus_time_f &lt;/SPAN&gt; &lt;STRONG&gt;(timestamp, format 'DDMMMYYYY:HH:MI:SS')&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Sep 2013 03:02:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Time-stamp-format-help/m-p/79856#M17212</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-09-13T03:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: Time stamp format help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Time-stamp-format-help/m-p/79857#M17213</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the context where the code will run is "explicit pass through" then Tom's use if the Teradata format looks most effective !&lt;/P&gt;&lt;P&gt;If "implicit pass through" then there should be no need for special arrangements as SAS automatically&amp;nbsp; understands and handles the datatypes like datetime constants.&lt;/P&gt;&lt;P&gt; Of course it has been some time since I programmed queries and user transforms in SAS DI.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 14 Sep 2013 06:56:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Time-stamp-format-help/m-p/79857#M17213</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2013-09-14T06:56:06Z</dc:date>
    </item>
  </channel>
</rss>

