<?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: Timestamp format of YYYY-MM-DD HH:MM:SS in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Timestamp-format-of-YYYY-MM-DD-HH-MM-SS/m-p/314714#M9004</link>
    <description>&lt;P&gt;Actually: The Timestamp datatype could also contain fractional seconds. If this is the case and given the usual precision challenges when transfering fractional values between platforms, I'd go for an approach where you cast the timestamp on the Teradata side to a string and then load the string to SAS.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Editor's note: &lt;A href="https://communities.sas.com/t5/SAS-Data-Management/date-macro-variable-in-explicit-pass-through-sql/m-p/324580#M9449" target="_self"&gt;another reader had a similar question and used CAST in PROC SQL passthru code to Teradata&lt;/A&gt; to reconcile date comparisons.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See also the &lt;A href="http://go.documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=leforinforref&amp;amp;docsetTarget=p1a0qt18rxydrkn1b0rtdfh2t8zs.htm&amp;amp;locale=en" target="_self"&gt;complete reference on ISO datetime formats available in SAS&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/127747"&gt;@arpitagarwal512&lt;/a&gt;&amp;nbsp;shared, this picture format can produce the original requested output:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
picture dtpic
other='%Y-%0m-%0d %0H:%0M:%0S' (datatype=datetime)
;
run;
data a;
 a = datetime();
 format a dtpic.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 30 Aug 2017 16:39:48 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2017-08-30T16:39:48Z</dc:date>
    <item>
      <title>Timestamp format of YYYY-MM-DD HH:MM:SS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Timestamp-format-of-YYYY-MM-DD-HH-MM-SS/m-p/314667#M8994</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We are using an Extract Transformation in SAS DI to extract data from Teradata to a file. One of the columns is a timestamp and in Teradata the format is&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;YYYY-MM-DD HH:MM:SS&lt;/PRE&gt;
&lt;P&gt;. The default SAS timestamp format returns the value in format like&amp;nbsp;30MAY2016:21:32:32 or&amp;nbsp;yyyy-mm-ddThh:mm:ss with a&amp;nbsp;‘T’ between the Date and Hour. Couple of options that we have tried are&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) Put in Proc format step in the precode of the job as below and use the format in the DI user written code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
&amp;nbsp; picture ymdhms other='%0Y-%0m-%0d %0H:%0M:%0S' (datatype=datetime);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) Cast the value to character data type to display it in the same format as the database?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there any existing SAS Date format that could be used to display the timestamp in the same format as the Teradata Timestamp format i.e, 'YYYY-MM-DD HH-MM-SS'.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;John&lt;/P&gt;</description>
      <pubDate>Wed, 30 Aug 2017 16:22:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Timestamp-format-of-YYYY-MM-DD-HH-MM-SS/m-p/314667#M8994</guid>
      <dc:creator>JM_VFAU</dc:creator>
      <dc:date>2017-08-30T16:22:30Z</dc:date>
    </item>
    <item>
      <title>Re: Timestamp format of YYYY-MM-DD HH:MM:SS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Timestamp-format-of-YYYY-MM-DD-HH-MM-SS/m-p/314683#M8995</link>
      <description>&lt;P&gt;Your question has HH:MM:SS but the last portion of your&amp;nbsp;question has HH-MM-SS which one are you looking for?&lt;/P&gt;
&lt;P&gt;Typically, it's HH:MM:SS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't think there's a standard one in the format you'd like. There is likely 2 together, one for the date portion and one for the time portion that would work, but not sure about a datetime format.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can review all the formats here, and they're organized by category to help you filter the date/datetime formats. The IS 8601 section is also date &amp;amp; time formats.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/documentation/cdl/en/leforinforref/64790/HTML/default/viewer.htm#n0p2fmevfgj470n17h4k9f27qjag.htm" target="_blank"&gt;https://support.sas.com/documentation/cdl/en/leforinforref/64790/HTML/default/viewer.htm#n0p2fmevfgj470n17h4k9f27qjag.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2016 00:14:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Timestamp-format-of-YYYY-MM-DD-HH-MM-SS/m-p/314683#M8995</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-11-28T00:14:04Z</dc:date>
    </item>
    <item>
      <title>Re: Timestamp format of YYYY-MM-DD HH:MM:SS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Timestamp-format-of-YYYY-MM-DD-HH-MM-SS/m-p/314688#M8996</link>
      <description>&lt;P&gt;Hi Rezza,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am looking for the output format YYYY-MM-DD HH:MM:SS. In the link the closest one is&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://support.sas.com/documentation/cdl/en/leforinforref/64790/HTML/default/n1xn55wyvuf9zin14s3ccylye2ck.htm" target="_blank"&gt;$N8601EX&lt;SPAN class="xis-userSuppliedValue"&gt;w.d&lt;/SPAN&gt;Format&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it has a 'T' between the Date and Time part.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2016 00:27:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Timestamp-format-of-YYYY-MM-DD-HH-MM-SS/m-p/314688#M8996</guid>
      <dc:creator>JM_VFAU</dc:creator>
      <dc:date>2016-11-28T00:27:53Z</dc:date>
    </item>
    <item>
      <title>Re: Timestamp format of YYYY-MM-DD HH:MM:SS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Timestamp-format-of-YYYY-MM-DD-HH-MM-SS/m-p/314689#M8997</link>
      <description>&lt;P&gt;Then the options you've outlined are the best alternatives, either creating your own or using a combination of date &amp;amp; time formats and converting to character.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not sure there's anything else we can suggest. If it doesn't exist, it doesn't exist. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2016 00:32:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Timestamp-format-of-YYYY-MM-DD-HH-MM-SS/m-p/314689#M8997</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-11-28T00:32:38Z</dc:date>
    </item>
    <item>
      <title>Re: Timestamp format of YYYY-MM-DD HH:MM:SS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Timestamp-format-of-YYYY-MM-DD-HH-MM-SS/m-p/314690#M8998</link>
      <description>&lt;P&gt;You can add a suggestion to SAS Idea's for it to be added in a future release.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2016 00:33:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Timestamp-format-of-YYYY-MM-DD-HH-MM-SS/m-p/314690#M8998</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-11-28T00:33:11Z</dc:date>
    </item>
    <item>
      <title>Re: Timestamp format of YYYY-MM-DD HH:MM:SS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Timestamp-format-of-YYYY-MM-DD-HH-MM-SS/m-p/314698#M9002</link>
      <description>&lt;P&gt;Thanks Reeza.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2016 01:52:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Timestamp-format-of-YYYY-MM-DD-HH-MM-SS/m-p/314698#M9002</guid>
      <dc:creator>JM_VFAU</dc:creator>
      <dc:date>2016-11-28T01:52:40Z</dc:date>
    </item>
    <item>
      <title>Re: Timestamp format of YYYY-MM-DD HH:MM:SS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Timestamp-format-of-YYYY-MM-DD-HH-MM-SS/m-p/314714#M9004</link>
      <description>&lt;P&gt;Actually: The Timestamp datatype could also contain fractional seconds. If this is the case and given the usual precision challenges when transfering fractional values between platforms, I'd go for an approach where you cast the timestamp on the Teradata side to a string and then load the string to SAS.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Editor's note: &lt;A href="https://communities.sas.com/t5/SAS-Data-Management/date-macro-variable-in-explicit-pass-through-sql/m-p/324580#M9449" target="_self"&gt;another reader had a similar question and used CAST in PROC SQL passthru code to Teradata&lt;/A&gt; to reconcile date comparisons.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;See also the &lt;A href="http://go.documentation.sas.com/?cdcId=pgmmvacdc&amp;amp;cdcVersion=9.4&amp;amp;docsetId=leforinforref&amp;amp;docsetTarget=p1a0qt18rxydrkn1b0rtdfh2t8zs.htm&amp;amp;locale=en" target="_self"&gt;complete reference on ISO datetime formats available in SAS&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And as&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/127747"&gt;@arpitagarwal512&lt;/a&gt;&amp;nbsp;shared, this picture format can produce the original requested output:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
picture dtpic
other='%Y-%0m-%0d %0H:%0M:%0S' (datatype=datetime)
;
run;
data a;
 a = datetime();
 format a dtpic.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Aug 2017 16:39:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Timestamp-format-of-YYYY-MM-DD-HH-MM-SS/m-p/314714#M9004</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-08-30T16:39:48Z</dc:date>
    </item>
    <item>
      <title>Re: Timestamp format of YYYY-MM-DD HH:MM:SS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Timestamp-format-of-YYYY-MM-DD-HH-MM-SS/m-p/314719#M9005</link>
      <description>&lt;P&gt;Thanks Patrick. Suggested the same to development team.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2016 03:55:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Timestamp-format-of-YYYY-MM-DD-HH-MM-SS/m-p/314719#M9005</guid>
      <dc:creator>JM_VFAU</dc:creator>
      <dc:date>2016-11-28T03:55:13Z</dc:date>
    </item>
    <item>
      <title>Re: Timestamp format of YYYY-MM-DD HH:MM:SS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Timestamp-format-of-YYYY-MM-DD-HH-MM-SS/m-p/335848#M9909</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This below proc format will not work when you have date like "12/11/1969"(dd/mm/yyyy) so this will generate putput like "1969-12-11 00:00:00" and&amp;nbsp;for date "13/11/1969" it will generate out "&amp;nbsp;1969-11-13 00:00:00"&lt;/P&gt;&lt;P&gt;proc format;&lt;BR /&gt;picture dtpic&lt;BR /&gt;other='%Y-%0m-%0d %0H:%0M:%0S' (datatype=datetime)&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;here for inout&amp;nbsp;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;12/11/1969&lt;/SPAN&gt;&lt;SPAN&gt;"(dd/mm/yyyy it should generate output &amp;nbsp;"1969-11-12 00:00:00"&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Feb 2017 09:49:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Timestamp-format-of-YYYY-MM-DD-HH-MM-SS/m-p/335848#M9909</guid>
      <dc:creator>arpitagarwal512</dc:creator>
      <dc:date>2017-02-25T09:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: Timestamp format of YYYY-MM-DD HH:MM:SS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Timestamp-format-of-YYYY-MM-DD-HH-MM-SS/m-p/335862#M9910</link>
      <description>&lt;P&gt;The variable you're showing is a date but the format is datetime format.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It looks like you should first create a datetime variable using DHMS() function.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;New_var = DHMS(old_var, 0, 0, 0);&lt;/P&gt;
&lt;P&gt;format new_var dtpic.;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Feb 2017 14:56:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Timestamp-format-of-YYYY-MM-DD-HH-MM-SS/m-p/335862#M9910</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-02-25T14:56:24Z</dc:date>
    </item>
    <item>
      <title>Re: Timestamp format of YYYY-MM-DD HH:MM:SS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Timestamp-format-of-YYYY-MM-DD-HH-MM-SS/m-p/354561#M10619</link>
      <description>&lt;P&gt;Sorry if this is too late to the party, but the format you're looking for is DATETIME20.9&lt;/P&gt;&lt;P&gt;If you need an &amp;nbsp;AM/PM in the date you can use DATEAMPM. (DATEAMPM13. for 13 characters, ect.)&lt;/P&gt;&lt;P&gt;The one thing I haven't been able to put together is how to get it to show it as DDMMYYYY. Seems to only do DDMMMYY (With the MMM being text).&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Monster&lt;/P&gt;</description>
      <pubDate>Fri, 28 Apr 2017 18:19:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Timestamp-format-of-YYYY-MM-DD-HH-MM-SS/m-p/354561#M10619</guid>
      <dc:creator>XMonsterX</dc:creator>
      <dc:date>2017-04-28T18:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: Timestamp format of YYYY-MM-DD HH:MM:SS</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Timestamp-format-of-YYYY-MM-DD-HH-MM-SS/m-p/354799#M10633</link>
      <description>&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;</description>
      <pubDate>Sun, 30 Apr 2017 10:17:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Timestamp-format-of-YYYY-MM-DD-HH-MM-SS/m-p/354799#M10633</guid>
      <dc:creator>JM_VFAU</dc:creator>
      <dc:date>2017-04-30T10:17:36Z</dc:date>
    </item>
  </channel>
</rss>

