<?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: sas mainframe datetime function in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/datetime-function-in-sas-mainframe/m-p/575334#M162723</link>
    <description>&lt;P&gt;Please don't start multiple threads for the same question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since all standard formats use colons as separators in the time part, you will have to create a custom picture format with proc format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Personally, I'd rather use the ISO 8601 international standard formats.&lt;/P&gt;</description>
    <pubDate>Mon, 22 Jul 2019 12:03:38 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2019-07-22T12:03:38Z</dc:date>
    <item>
      <title>datetime function in sas mainframe</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datetime-function-in-sas-mainframe/m-p/575288#M162699</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;i'm facing sas DateTime function issue in my current job please find below the code&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;DATA _TIME;&lt;BR /&gt;INFILE DATALINES;&lt;BR /&gt;INPUT CMS_DAT $char30.;&lt;/P&gt;&lt;P&gt;CMS_DT = PUT(CMS_DAT, DATETIME30.6);&lt;BR /&gt;DATALINES;&lt;BR /&gt;22MAR2018:12:32:43.491538&lt;BR /&gt;06DEC2017:13:31:54.664700&lt;BR /&gt;03JAN2018:08:33:57.142454&lt;BR /&gt;17OCT2017:14:33:19.866942&lt;BR /&gt;28MAR2018:07:33:28.239593&lt;BR /&gt;;&amp;nbsp;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;and my rec is :&amp;nbsp;&lt;FONT color="#FF6600"&gt;2018-03-22-12.32.43.491538&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF6600"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;so kindly sugeust solution for above sas mainframe code&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&amp;amp; if i remove that put statment i'm getting sum other values after mention put statment it gving exact input values i'm not getting expecting results has mention on the colour&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;thanks &amp;amp; regards&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;rohit&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2019 07:42:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datetime-function-in-sas-mainframe/m-p/575288#M162699</guid>
      <dc:creator>rohitkrishna</dc:creator>
      <dc:date>2019-07-22T07:42:39Z</dc:date>
    </item>
    <item>
      <title>Re: datetime function in sas mainframe</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datetime-function-in-sas-mainframe/m-p/575296#M162704</link>
      <description>&lt;P&gt;Use the proper informat and format:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _time;
infile datalines;
input cms_dat datetime26.;
format cms_dat datetime26.6;
cms_dt = put(cms_dat, datetime30.6);
datalines;
22MAR2018:12:32:43.491538
06DEC2017:13:31:54.664700
03JAN2018:08:33:57.142454
17OCT2017:14:33:19.866942
28MAR2018:07:33:28.239593
; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;datetime values are numeric, read and handle them as such.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2019 08:13:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datetime-function-in-sas-mainframe/m-p/575296#M162704</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-22T08:13:10Z</dc:date>
    </item>
    <item>
      <title>Re: datetime function in sas mainframe</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datetime-function-in-sas-mainframe/m-p/575307#M162709</link>
      <description>Hi Kurtbremser&lt;BR /&gt;thanks for the quick reply&lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt;CMS_DAT CMS_DT&lt;BR /&gt;&lt;BR /&gt;22MAR2018:12:32:43.491538 22MAR2018:12:32:43.491538&lt;BR /&gt;06DEC2017:13:31:54.664700 06DEC2017:13:31:54.664700&lt;BR /&gt;03JAN2018:08:33:57.142454 03JAN2018:08:33:57.142454&lt;BR /&gt;17OCT2017:14:33:19.866942 17OCT2017:14:33:19.866942&lt;BR /&gt;. .&lt;BR /&gt;28MAR2018:07:33:28.239593 28MAR2018:07:33:28.239593&lt;BR /&gt;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;I'm getting above results are not exact results&lt;BR /&gt;&lt;BR /&gt;i want my results should like: 2018-03-22-12.32.43.491538&lt;BR /&gt;&lt;BR /&gt;thanks &amp;amp; regards&lt;BR /&gt;rohit</description>
      <pubDate>Mon, 22 Jul 2019 09:18:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datetime-function-in-sas-mainframe/m-p/575307#M162709</guid>
      <dc:creator>rohitkrishna</dc:creator>
      <dc:date>2019-07-22T09:18:02Z</dc:date>
    </item>
    <item>
      <title>Re: datetime function in sas mainframe</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datetime-function-in-sas-mainframe/m-p/575317#M162716</link>
      <description>hi all&lt;BR /&gt;try to help out for the above problem&lt;BR /&gt;i want my results should be like&lt;BR /&gt;&lt;BR /&gt;(2018-03-22-12.32.43.491538) I need output value,&lt;BR /&gt;not like&lt;BR /&gt;(22MAR2018:12:32:43.491538) this is an input value&lt;BR /&gt;thanks &amp;amp; regards&lt;BR /&gt;rohit&lt;BR /&gt;</description>
      <pubDate>Mon, 22 Jul 2019 10:05:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datetime-function-in-sas-mainframe/m-p/575317#M162716</guid>
      <dc:creator>rohitkrishna</dc:creator>
      <dc:date>2019-07-22T10:05:34Z</dc:date>
    </item>
    <item>
      <title>sas mainframe datetime function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datetime-function-in-sas-mainframe/m-p/575320#M162721</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I required sum suggestion or solution for the below sas mainframe DateTime function job&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(&lt;/P&gt;&lt;P&gt;DATA _TIME;&lt;BR /&gt;INFILE DATALINES;&lt;BR /&gt;INPUT CMS_DAT DATETIME26.;&lt;BR /&gt;FORMAT CMS_DAT DATETIME26.6;&lt;BR /&gt;CMS_DT = PUT(CMS_DAT, DATETIME30.6);&lt;BR /&gt;DATALINES;&lt;BR /&gt;22MAR2018:12:32:43.491538&lt;BR /&gt;06DEC2017:13:31:54.664700&lt;BR /&gt;03JAN2018:08:33:57.142454&lt;BR /&gt;17OCT2017:14:33:19.866942&lt;BR /&gt;28MAR2018:07:33:28.239593&lt;BR /&gt;;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;and I want my results should be like&lt;/FONT&gt;&amp;nbsp;(&lt;FONT color="#FF6600"&gt;2018-03-22-12:32:43.491538) expected results&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF6600"&gt;try to suggest some solution for the above sas code&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;thanks &amp;amp; regards&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;rohit&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2019 10:44:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datetime-function-in-sas-mainframe/m-p/575320#M162721</guid>
      <dc:creator>rohitkrishna</dc:creator>
      <dc:date>2019-07-22T10:44:39Z</dc:date>
    </item>
    <item>
      <title>Re: sas mainframe datetime function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datetime-function-in-sas-mainframe/m-p/575323#M162722</link>
      <description>sorry results should be like&lt;BR /&gt;2018-03-22-12.32.43.491538&lt;BR /&gt;</description>
      <pubDate>Mon, 22 Jul 2019 10:46:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datetime-function-in-sas-mainframe/m-p/575323#M162722</guid>
      <dc:creator>rohitkrishna</dc:creator>
      <dc:date>2019-07-22T10:46:17Z</dc:date>
    </item>
    <item>
      <title>Re: sas mainframe datetime function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datetime-function-in-sas-mainframe/m-p/575334#M162723</link>
      <description>&lt;P&gt;Please don't start multiple threads for the same question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since all standard formats use colons as separators in the time part, you will have to create a custom picture format with proc format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Personally, I'd rather use the ISO 8601 international standard formats.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2019 12:03:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datetime-function-in-sas-mainframe/m-p/575334#M162723</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-22T12:03:38Z</dc:date>
    </item>
    <item>
      <title>Re: sas mainframe datetime function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datetime-function-in-sas-mainframe/m-p/575335#M162724</link>
      <description>&lt;P&gt;You could concatenate strings created by the YYMMDDx. format and the TIME. format.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2019 12:07:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datetime-function-in-sas-mainframe/m-p/575335#M162724</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-07-22T12:07:28Z</dc:date>
    </item>
    <item>
      <title>Re: sas mainframe datetime function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datetime-function-in-sas-mainframe/m-p/575356#M162734</link>
      <description>hi kurtbremser&lt;BR /&gt;I'm not getting you're point what you mention above statement&lt;BR /&gt;my requirement is to change the month&lt;BR /&gt;Jan to 01&lt;BR /&gt;Feb to 02 like that&lt;BR /&gt;remaining I can translate: to. I know that part but how to change this month is sum difficult to me&lt;BR /&gt;i use if condition for month change&lt;BR /&gt;if month = 'jan' then month = 01 like that&lt;BR /&gt;thanks &amp;amp; regards&lt;BR /&gt;rohit&lt;BR /&gt;</description>
      <pubDate>Mon, 22 Jul 2019 12:59:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datetime-function-in-sas-mainframe/m-p/575356#M162734</guid>
      <dc:creator>rohitkrishna</dc:creator>
      <dc:date>2019-07-22T12:59:56Z</dc:date>
    </item>
    <item>
      <title>Re: sas mainframe datetime function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datetime-function-in-sas-mainframe/m-p/575365#M162739</link>
      <description>&lt;P&gt;We've already covered reading datetime strings with three-letter month names. To extract the month from the datetime value, use the datepart() and month() functions.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2019 13:27:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datetime-function-in-sas-mainframe/m-p/575365#M162739</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-22T13:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: sas mainframe datetime function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datetime-function-in-sas-mainframe/m-p/575383#M162748</link>
      <description>&lt;P&gt;As implied by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;, you will not get where you want to go (or you will work very hard at it) unless you use the built-in SAS date and time functions (such as datepart and timepart) and date and time formats.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is an example that gets you the desired end result&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
	set _time;
	result = cats(put(datepart(cms_dat),yymmddd10.),'-',put(timepart(cms_dat),time18.6));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2019 14:30:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datetime-function-in-sas-mainframe/m-p/575383#M162748</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-07-22T14:30:17Z</dc:date>
    </item>
    <item>
      <title>Re: sas mainframe datetime function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datetime-function-in-sas-mainframe/m-p/575653#M162889</link>
      <description>&lt;P&gt;And here's an example of building a custom datetime format:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format library=work;
picture mydt
  low-high = '%Y-%0m-%0d-%0H.%0M.%0s' (datatype=datetime)
;
run;

data _time;
infile datalines;
input cms_dat datetime26.;
format cms_dat mydt26.6;
cms_dt = put(cms_dat,mydt26.6);
datalines;
22MAR2018:12:32:43.491538
06DEC2017:13:31:54.664700
03JAN2018:08:33:57.142454
17OCT2017:14:33:19.866942
28MAR2018:07:33:28.239593
;

proc print data=_time noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;cms_dat                                 cms_dt

2018-03-22-12.32.43.491538    2018-03-22-12.32.43.491538
2017-12-06-13.31.54.664700    2017-12-06-13.31.54.664700
2018-01-03-08.33.57.142454    2018-01-03-08.33.57.142454
2017-10-17-14.33.19.866942    2017-10-17-14.33.19.866942
2018-03-28-07.33.28.239593    2018-03-28-07.33.28.239593
&lt;/PRE&gt;</description>
      <pubDate>Tue, 23 Jul 2019 06:29:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datetime-function-in-sas-mainframe/m-p/575653#M162889</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-23T06:29:35Z</dc:date>
    </item>
    <item>
      <title>Re: sas mainframe datetime function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/datetime-function-in-sas-mainframe/m-p/575692#M162901</link>
      <description>Hi KurtBremser, PaigeMiller&lt;BR /&gt;Thanks for the help it superb it's working&lt;BR /&gt;Thanks &amp;amp; regards&lt;BR /&gt;rohit&lt;BR /&gt;</description>
      <pubDate>Tue, 23 Jul 2019 08:46:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/datetime-function-in-sas-mainframe/m-p/575692#M162901</guid>
      <dc:creator>rohitkrishna</dc:creator>
      <dc:date>2019-07-23T08:46:58Z</dc:date>
    </item>
  </channel>
</rss>

