<?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: Display date in time format in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Display-date-in-time-format/m-p/326409#M62314</link>
    <description>&lt;P&gt;By any chance do you want the TIMEPART of decision_date for the second value?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;decision_date2=TIMEpart(decision_date);&lt;/P&gt;
&lt;P&gt;Times and Datetimes in SAS are seconds, Dates are days. You will not have much luck displaying DATES with a TIME value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you permanently attach a format to a variable that will generally be the default for most output that does not involve a calculation (sas as mean in proc means/summary output for instance). Or specify the format in procedure generating the output such as Proc print. One of the nice things with the SAS formats is the ability to override them as needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, one of my pet peeves&amp;nbsp;is calling datetime values a date, or time values a date or dates a time/datetime.&amp;nbsp;While other data systems may not care the measurement differences in SAS make it important.&amp;nbsp;&amp;nbsp;Proper use of functions and or formats requires that understanding. Both values are numeric and numeric functions generally don't care what you give them. Consider:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data _null_;
   file print;
   x="10:15:23"t;
   y=month(x);
   put y=  ;
run;&lt;/PRE&gt;
&lt;P&gt;I declared a TIME variable and them applied a DATE function. What would the result for Y actually mean if it appears in your output?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 20 Jan 2017 20:53:35 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2017-01-20T20:53:35Z</dc:date>
    <item>
      <title>Display date in time format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Display-date-in-time-format/m-p/326406#M62313</link>
      <description>&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; uw_hist_1;&lt;/P&gt;
&lt;P&gt;set uw_hist;&lt;/P&gt;
&lt;P&gt;decision_date1=datepart(decision_date);&lt;/P&gt;
&lt;P&gt;decision_date2=datepart(decision_date);&lt;/P&gt;
&lt;P&gt;format decision_date1 mmddyy10.;&lt;/P&gt;
&lt;P&gt;put decision_date2 hhmm8.2;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="437"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="77"&gt;
&lt;P&gt;LNKEY&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="155"&gt;
&lt;P&gt;DECISION_DATE&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="103"&gt;
&lt;P&gt;decision_date1&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="103"&gt;
&lt;P&gt;decision_date2&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="77"&gt;
&lt;P&gt;4001532474&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="155"&gt;
&lt;P&gt;24Sep2016 7:24:00.000&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="103"&gt;
&lt;P&gt;09/24/2016&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="103"&gt;
&lt;P&gt;20721&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="77"&gt;
&lt;P&gt;4001474487&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="155"&gt;
&lt;P&gt;29Sep2016 16:52:00.000&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="103"&gt;
&lt;P&gt;09/29/2016&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="103"&gt;
&lt;P&gt;20726&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="77"&gt;
&lt;P&gt;4001474487&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="155"&gt;
&lt;P&gt;27Oct2016 18:11:00.000&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="103"&gt;
&lt;P&gt;10/27/2016&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="103"&gt;
&lt;P&gt;20754&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="77"&gt;
&lt;P&gt;4001532474&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="155"&gt;
&lt;P&gt;28Nov2016 14:24:00.000&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="103"&gt;
&lt;P&gt;11/28/2016&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="103"&gt;
&lt;P&gt;20786&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to display the time for decision_date2 in time format like this I used hhmm8.2 however I get different results in decision_date2.&amp;nbsp; How can I obtain the time format and would it maintain once I exported, especially in ODS whcih is the ultimate output&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 20:36:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Display-date-in-time-format/m-p/326406#M62313</guid>
      <dc:creator>Q1983</dc:creator>
      <dc:date>2017-01-20T20:36:22Z</dc:date>
    </item>
    <item>
      <title>Re: Display date in time format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Display-date-in-time-format/m-p/326409#M62314</link>
      <description>&lt;P&gt;By any chance do you want the TIMEPART of decision_date for the second value?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;decision_date2=TIMEpart(decision_date);&lt;/P&gt;
&lt;P&gt;Times and Datetimes in SAS are seconds, Dates are days. You will not have much luck displaying DATES with a TIME value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you permanently attach a format to a variable that will generally be the default for most output that does not involve a calculation (sas as mean in proc means/summary output for instance). Or specify the format in procedure generating the output such as Proc print. One of the nice things with the SAS formats is the ability to override them as needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, one of my pet peeves&amp;nbsp;is calling datetime values a date, or time values a date or dates a time/datetime.&amp;nbsp;While other data systems may not care the measurement differences in SAS make it important.&amp;nbsp;&amp;nbsp;Proper use of functions and or formats requires that understanding. Both values are numeric and numeric functions generally don't care what you give them. Consider:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data _null_;
   file print;
   x="10:15:23"t;
   y=month(x);
   put y=  ;
run;&lt;/PRE&gt;
&lt;P&gt;I declared a TIME variable and them applied a DATE function. What would the result for Y actually mean if it appears in your output?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 20:53:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Display-date-in-time-format/m-p/326409#M62314</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-01-20T20:53:35Z</dc:date>
    </item>
    <item>
      <title>Re: Display date in time format</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Display-date-in-time-format/m-p/326412#M62315</link>
      <description>&lt;P&gt;Your code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data uw_hist_1;
set uw_hist;
decision_date1=datepart(decision_date);
decision_date2=&lt;STRONG&gt;datepart&lt;/STRONG&gt;(decision_date);  /* Didn'y you mean: &lt;STRONG&gt;timepart&lt;/STRONG&gt; ? */
format decision_date1 mmddyy10.;
put decision_date2 hhmm8.2;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;What is the logic of subsetin&amp;nbsp;&lt;STRONG&gt;datepart&lt;/STRONG&gt; and displaying it with&amp;nbsp;&lt;STRONG&gt;hhmm&lt;/STRONG&gt; format ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Jan 2017 20:54:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Display-date-in-time-format/m-p/326412#M62315</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-01-20T20:54:09Z</dc:date>
    </item>
  </channel>
</rss>

