<?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 SQL Convert decimal to minutes and seconds (SAS) in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Proc-SQL-Convert-decimal-to-minutes-and-seconds-SAS/m-p/732590#M28501</link>
    <description>&lt;P&gt;Do you really need to convert 123 to 2:03 (a text string with a colon in it)? Or can you leave the 123 as 123 and then format it so that it appears as 2:03. The latter would be incredibly simple.&lt;/P&gt;</description>
    <pubDate>Fri, 09 Apr 2021 18:49:09 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2021-04-09T18:49:09Z</dc:date>
    <item>
      <title>Proc SQL Convert decimal to minutes and seconds (SAS)</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-SQL-Convert-decimal-to-minutes-and-seconds-SAS/m-p/732574#M28497</link>
      <description>&lt;P&gt;I am trying to convert decimal (seconds) to minutes seconds, so 123 decimal (seconds) would be 2:03 (2 minutes 3 seconds) or 0 hours 2 minutes 3 seconds)&lt;/P&gt;&lt;P&gt;I am using SAS EG 7.12 and need to do this in PROC SQL not a data step.&lt;/P&gt;&lt;P&gt;I have this working in MS SQL using convert and DATEADD, somehow everything I try in SAS fails,&amp;nbsp;&lt;/P&gt;&lt;P&gt;The duration is field is numeric.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 18:07:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-SQL-Convert-decimal-to-minutes-and-seconds-SAS/m-p/732574#M28497</guid>
      <dc:creator>R_Auger</dc:creator>
      <dc:date>2021-04-09T18:07:16Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Convert decimal to minutes and seconds (SAS)</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-SQL-Convert-decimal-to-minutes-and-seconds-SAS/m-p/732583#M28498</link>
      <description>&lt;P&gt;You can add your duration field expressed in seconds to any SAS datetime variable and get the correct result. That's because SAS datetimes are also expressed in seconds. But SAS also supports SAS date variables. Those are expressed in days.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, the first thing to figure out is the nature of the variable to which the duration will be added. Looking at the format and range of a variable is sometimes useful in guessing what it represents. Typical values:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; 69         data _null_;
 70         d = today();
 71         dt = datetime();
 72         put d / d date11. / dt / dt datetime20.;
 73         run;
 
 22379
 09-APR-2021
 1933597801.4
   09APR2021:14:30:01&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Apr 2021 18:33:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-SQL-Convert-decimal-to-minutes-and-seconds-SAS/m-p/732583#M28498</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2021-04-09T18:33:07Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Convert decimal to minutes and seconds (SAS)</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-SQL-Convert-decimal-to-minutes-and-seconds-SAS/m-p/732584#M28499</link>
      <description>Sorry, the field type is Numeric and is not a date/datetime it is session duration and is shown as 123, 456, 743 which are decimals that represent seconds, 123 seconds, 456 seconds etc. I need to show 2:03 (2 minutes 3 seconds) in SQ I am using Convert and it works, in Proc SQL I tied suing PUT/INPUT and it is not working.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 09 Apr 2021 18:38:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-SQL-Convert-decimal-to-minutes-and-seconds-SAS/m-p/732584#M28499</guid>
      <dc:creator>R_Auger</dc:creator>
      <dc:date>2021-04-09T18:38:34Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Convert decimal to minutes and seconds (SAS)</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-SQL-Convert-decimal-to-minutes-and-seconds-SAS/m-p/732590#M28501</link>
      <description>&lt;P&gt;Do you really need to convert 123 to 2:03 (a text string with a colon in it)? Or can you leave the 123 as 123 and then format it so that it appears as 2:03. The latter would be incredibly simple.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 18:49:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-SQL-Convert-decimal-to-minutes-and-seconds-SAS/m-p/732590#M28501</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-04-09T18:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Convert decimal to minutes and seconds (SAS)</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-SQL-Convert-decimal-to-minutes-and-seconds-SAS/m-p/732591#M28502</link>
      <description>&lt;P&gt;SAS times are stored in numeric variables with a time format assigned. SAS times and datetimes are counts of seconds, the proof can be seen here:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
duration = 123;
run;

proc sql;
create table want as
select duration, duration as time format=time8.
from have;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Apr 2021 18:49:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-SQL-Convert-decimal-to-minutes-and-seconds-SAS/m-p/732591#M28502</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-04-09T18:49:39Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Convert decimal to minutes and seconds (SAS)</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-SQL-Convert-decimal-to-minutes-and-seconds-SAS/m-p/732594#M28503</link>
      <description>&lt;P&gt;If all you need is to display the duration with a given format then give it that format in proc SQL. Here I use the mmss. format&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select 
    123 as duration format=mmss.,
    count(*) as dummy
from sashelp.class;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PGStats_0-1617994209604.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/57235i3C6BC84D684C6D7D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PGStats_0-1617994209604.png" alt="PGStats_0-1617994209604.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 18:50:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-SQL-Convert-decimal-to-minutes-and-seconds-SAS/m-p/732594#M28503</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2021-04-09T18:50:21Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Convert decimal to minutes and seconds (SAS)</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-SQL-Convert-decimal-to-minutes-and-seconds-SAS/m-p/732595#M28504</link>
      <description>If it can be done in formatting, I am ok with that. I still need to account for decimals that would be great enough for example to be 1 hour 5 min and 6 seconds&lt;BR /&gt;There is not calculation done on this field</description>
      <pubDate>Fri, 09 Apr 2021 18:51:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-SQL-Convert-decimal-to-minutes-and-seconds-SAS/m-p/732595#M28504</guid>
      <dc:creator>R_Auger</dc:creator>
      <dc:date>2021-04-09T18:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: Proc SQL Convert decimal to minutes and seconds (SAS)</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Proc-SQL-Convert-decimal-to-minutes-and-seconds-SAS/m-p/732598#M28505</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want (tm numeric format=time8.);
insert into want values (3906);
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Apr 2021 18:56:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Proc-SQL-Convert-decimal-to-minutes-and-seconds-SAS/m-p/732598#M28505</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-04-09T18:56:17Z</dc:date>
    </item>
  </channel>
</rss>

