<?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: PROC FORMAT Help in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/PROC-FORMAT-Help/m-p/209096#M51828</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please mark question as answered &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 05 May 2015 04:03:40 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2015-05-05T04:03:40Z</dc:date>
    <item>
      <title>PROC FORMAT Help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-FORMAT-Help/m-p/209090#M51822</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Hello, I am trying to create my own format using PROC FORMAT and apply this format to show the difference in days, hours, min, sec between two datetimes.&amp;nbsp; The hours, minutes and seconds calculate perfectly but I can't seem to find any directive that will display the number of days correctly.&amp;nbsp; If anyone could help me figure this out, I would really appreciate it.&amp;nbsp; Here's my code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN id="419723810.0" style="font-family: Courier New;"&gt;PROC&lt;/SPAN&gt; &lt;SPAN id="419723825.0" style="font-family: Courier New;"&gt;FORMAT&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN id="419723825.0" style="color: #000000; font-family: Courier New;"&gt;;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN id="419723825.0" style="color: #0000ff; font-family: Courier New;"&gt;PICTURE&lt;/SPAN&gt;&lt;SPAN id="419723825.0" style="color: #000000; font-family: Courier New;"&gt; Diff_Format&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN id="419723825.0" style="color: #000000; font-family: Courier New;"&gt;LOW-HIGH =&lt;/SPAN&gt; &lt;SPAN id="419723825.0" style="color: #800080; font-family: Courier New;"&gt;'%N days, %H hrs, %M min, %S sec'&lt;/SPAN&gt;&lt;SPAN id="419723825.0" style="color: #000000; font-family: Courier New;"&gt; (&lt;/SPAN&gt;&lt;SPAN id="419723825.0" style="color: #0000ff; font-family: Courier New;"&gt;DATATYPE&lt;/SPAN&gt;&lt;SPAN id="419723825.0" style="color: #000000; font-family: Courier New;"&gt;=DATETIME);&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN id="419723825.0" style="font-family: Courier New;"&gt;QUIT&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN id="419723825.0" style="color: #000000; font-family: Courier New;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN id="419723825.0" style="font-family: Courier New;"&gt;data&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN id="419723825.0" style="color: #0000ff; font-family: Courier New;"&gt;_null_&lt;/SPAN&gt;&lt;SPAN id="419723825.0" style="color: #000000; font-family: Courier New;"&gt;;&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN id="419723825.0" style="color: #000000; font-family: Courier New;"&gt;StartDate =&lt;/SPAN&gt;&lt;STRONG&gt; &lt;SPAN id="419723825.0" style="color: #008080; font-family: Courier New;"&gt;'15APR2015:15:23:32'dt&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN id="419723825.0" style="color: #000000; font-family: Courier New;"&gt;;&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN id="419723825.0" style="color: #000000; font-family: Courier New;"&gt;EndDate =&lt;/SPAN&gt;&lt;STRONG&gt; &lt;SPAN id="419723825.0" style="color: #008080; font-family: Courier New;"&gt;'18APR2015:16:44:56'dt&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN id="419723825.0" style="color: #000000; font-family: Courier New;"&gt;;&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN id="419723825.0" style="color: #000000; font-family: Courier New;"&gt;Difference = EndDate - StartDate;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN id="419723825.0" style="color: #008000; font-family: Courier New;"&gt;/* Calculating the difference */&lt;/SPAN&gt; &lt;BR /&gt;&lt;SPAN id="419723825.0" style="color: #0000ff; font-family: Courier New;"&gt;PUT&lt;/SPAN&gt;&lt;SPAN id="419723825.0" style="color: #000000; font-family: Courier New;"&gt; Difference =&lt;/SPAN&gt; &lt;SPAN id="419723825.0" style="color: #008080; font-family: Courier New;"&gt;Diff_Format.&lt;/SPAN&gt;&lt;SPAN id="419723825.0" style="color: #000000; font-family: Courier New;"&gt;;&lt;/SPAN&gt; &lt;BR /&gt;&lt;STRONG&gt;&lt;SPAN id="419723825.0" style="font-family: Courier New;"&gt;RUN&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN id="419723825.0" style="color: #000000; font-family: Courier New;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Courier New;"&gt;The answer should be -&amp;gt; &lt;/SPAN&gt;Difference=03 days, 1 hrs, 21 min, 24 sec&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: #000000; font-family: Courier New;"&gt;But this code yields -&amp;gt; &lt;/SPAN&gt;Difference=01 days, 1 hrs, 21 min, 24 sec&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 May 2015 17:55:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-FORMAT-Help/m-p/209090#M51822</guid>
      <dc:creator>T_Harrell</dc:creator>
      <dc:date>2015-05-04T17:55:39Z</dc:date>
    </item>
    <item>
      <title>Re: PROC FORMAT Help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-FORMAT-Help/m-p/209091#M51823</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't have an answer but I also don't get the same result you do, so I'm confused :smileyconfused:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SAS 9.3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;1151&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;1152&amp;nbsp; data want;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;1153&amp;nbsp; format startdate enddate datetime21.;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;1154&amp;nbsp; StartDate = '15APR2015:15:23:32'dt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;1155&amp;nbsp; EndDate = '18APR2015:16:44:56'dt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;1156&amp;nbsp; Difference = EndDate - StartDate;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;1157&amp;nbsp; /* Calculating the difference */&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;1158&amp;nbsp; PUT Difference = Diff_Format.;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;1159&amp;nbsp; put difference = datetime21.;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;1160&amp;nbsp; RUN;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;Difference=0 days, 1 hrs, 21 min, 24 sec&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;Difference=04JAN1960:01:21:24&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;NOTE: The data set WORK.WANT has 1 observations and 3 variables.&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;NOTE: DATA statement used (Total process time):&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; real time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 seconds&lt;/P&gt;&lt;P style="font-size: 8px; font-family: Courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cpu time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.00 seconds&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 May 2015 18:13:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-FORMAT-Help/m-p/209091#M51823</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-05-04T18:13:58Z</dc:date>
    </item>
    <item>
      <title>Re: PROC FORMAT Help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-FORMAT-Help/m-p/209092#M51824</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To get the right result use DATATYPE = TIME on your PICTURE FORMAT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is because you are counting time intervals not datetime intervals.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 May 2015 20:07:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-FORMAT-Help/m-p/209092#M51824</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2015-05-04T20:07:01Z</dc:date>
    </item>
    <item>
      <title>Re: PROC FORMAT Help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-FORMAT-Help/m-p/209093#M51825</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello SASKiwi, my values are datetime because I want to know the difference in days, hours, min, sec.&amp;nbsp; Were you successful in running my code with DATATYPE = TIME?&amp;nbsp; When I ran it, there were errors.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 May 2015 20:20:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-FORMAT-Help/m-p/209093#M51825</guid>
      <dc:creator>T_Harrell</dc:creator>
      <dc:date>2015-05-04T20:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: PROC FORMAT Help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-FORMAT-Help/m-p/209094#M51826</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The DATATYPE= has to be time, also the directives are case sensitive, it should work using the following code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV style="font-family: Courier New; font-size: 11pt;"&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;PROC&lt;/STRONG&gt; &lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;FORMAT&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;PICTURE&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; Diff_Format&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LOW-HIGH = &lt;/SPAN&gt;&lt;SPAN style="color: #800080; background-color: #ffffff;"&gt;'%n days, %H hrs, %M min, %S sec'&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; (&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;DATATYPE&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;=time)&lt;BR /&gt;&amp;nbsp; ;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;QUIT&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;data&lt;/STRONG&gt; &lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;_null_&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp; StartDate = &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;'15APR2015:15:23:32'dt&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp; EndDate = &lt;/SPAN&gt;&lt;STRONG style="color: #008080; background-color: #ffffff;"&gt;'18APR2015:16:44:56'dt&lt;/STRONG&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp; Difference = EndDate - StartDate;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #008000; background-color: #ffffff;"&gt;/* Calculating the difference */&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; background-color: #ffffff;"&gt;PUT&lt;/SPAN&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt; Difference = &lt;/SPAN&gt;&lt;SPAN style="color: #008080; background-color: #ffffff;"&gt;Diff_Format.&lt;/SPAN&gt;; &lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;STRONG style="color: #000080; background-color: #ffffff;"&gt;RUN&lt;/STRONG&gt;&lt;SPAN style="color: #000000; background-color: #ffffff;"&gt;;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 May 2015 20:44:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-FORMAT-Help/m-p/209094#M51826</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2015-05-04T20:44:54Z</dc:date>
    </item>
    <item>
      <title>Re: PROC FORMAT Help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-FORMAT-Help/m-p/209095#M51827</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, it worked perfectly!&amp;nbsp; Thanks everyone for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 May 2015 21:02:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-FORMAT-Help/m-p/209095#M51827</guid>
      <dc:creator>T_Harrell</dc:creator>
      <dc:date>2015-05-04T21:02:12Z</dc:date>
    </item>
    <item>
      <title>Re: PROC FORMAT Help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PROC-FORMAT-Help/m-p/209096#M51828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please mark question as answered &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 May 2015 04:03:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PROC-FORMAT-Help/m-p/209096#M51828</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-05-05T04:03:40Z</dc:date>
    </item>
  </channel>
</rss>

