<?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: Convert time duration given in &amp;quot;yrs mons days hrs mins sec&amp;quot; to minutes ONLY in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Convert-time-duration-given-in-quot-yrs-mons-days-hrs-mins-sec/m-p/510305#M72983</link>
    <description>&lt;P&gt;You have to parse the string into the needed parts, using the SCAN function. So the 7th "word" is the number of hours, the 9th "word" is the number of minutes and so on. From there, it ought to be easy to compute the desired number of minutes.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 05 Nov 2018 02:33:44 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2018-11-05T02:33:44Z</dc:date>
    <item>
      <title>Convert time duration given in "yrs mons days hrs mins sec" to minutes ONLY</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Convert-time-duration-given-in-quot-yrs-mons-days-hrs-mins-sec/m-p/510301#M72981</link>
      <description>&lt;P&gt;I'm working on a dataset which has a variable "phonecall_duration". The variable is in Character format and the values in rows look something like this :&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;phonecall_duration&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0 years 0 mons 0 days 0 hours 0 mins 48.00 secs&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0 years 0 mons 0 days 1 hours&amp;nbsp;2 mins 15.00 secs&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0 years 0 mons 0 days 2 hours 7 mins 28.00 secs&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0 years 0 mons 0 days 0 hours 9 mins 27.00 secs&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want is a variable "minutes" which basically calculates this time duration in minutes only(i.e by adding hours+minutes+sec) with up to&amp;nbsp;2 decimal places. The table will look like this.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;minutes&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;0.8&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;62.25&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;127.47&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;9.45&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I read a lot of documents and codes however I couldn't figure out an efficient way to do this since the variable is not a SAS TIME format. Please suggest.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Nov 2018 02:16:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Convert-time-duration-given-in-quot-yrs-mons-days-hrs-mins-sec/m-p/510301#M72981</guid>
      <dc:creator>Asquared</dc:creator>
      <dc:date>2018-11-05T02:16:25Z</dc:date>
    </item>
    <item>
      <title>Re: Convert time duration given in "yrs mons days hrs mins sec" to minutes ONLY</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Convert-time-duration-given-in-quot-yrs-mons-days-hrs-mins-sec/m-p/510304#M72982</link>
      <description>&lt;P&gt;It looks like a well formatted string, so use SCAN() to get the nth elements in this case the 1st is year, 3 is months, 5 is days etc. Then do the math using the SUM() function. You'll likely need INPUT() to convert it to a number as well to avoid type conversion notes in your log. &lt;BR /&gt;&lt;BR /&gt;If you've 'read a lot of documents and codes' it helps to also show what you've tried so we don't suggest things you already know don't work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/148228"&gt;@Asquared&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I'm working on a dataset which has a variable "phonecall_duration". The variable is in Character format and the values in rows look something like this :&lt;/P&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;phonecall_duration&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;0 years 0 mons 0 days 0 hours 0 mins 48.00 secs&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;0 years 0 mons 0 days 1 hours&amp;nbsp;2 mins 15.00 secs&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;0 years 0 mons 0 days 2 hours 7 mins 28.00 secs&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;0 years 0 mons 0 days 0 hours 9 mins 27.00 secs&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I want is a variable "minutes" which basically calculates this time duration in minutes only(i.e by adding hours+minutes+sec) with up to&amp;nbsp;2 decimal places. The table will look like this.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;minutes&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;0.8&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;62.25&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;127.47&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;9.45&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I read a lot of documents and codes however I couldn't figure out an efficient way to do this since the variable is not a SAS TIME format. Please suggest.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Nov 2018 02:36:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Convert-time-duration-given-in-quot-yrs-mons-days-hrs-mins-sec/m-p/510304#M72982</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-11-05T02:36:01Z</dc:date>
    </item>
    <item>
      <title>Re: Convert time duration given in "yrs mons days hrs mins sec" to minutes ONLY</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Convert-time-duration-given-in-quot-yrs-mons-days-hrs-mins-sec/m-p/510305#M72983</link>
      <description>&lt;P&gt;You have to parse the string into the needed parts, using the SCAN function. So the 7th "word" is the number of hours, the 9th "word" is the number of minutes and so on. From there, it ought to be easy to compute the desired number of minutes.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Nov 2018 02:33:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Convert-time-duration-given-in-quot-yrs-mons-days-hrs-mins-sec/m-p/510305#M72983</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-11-05T02:33:44Z</dc:date>
    </item>
    <item>
      <title>Re: Convert time duration given in "yrs mons days hrs mins sec" to minutes ONLY</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Convert-time-duration-given-in-quot-yrs-mons-days-hrs-mins-sec/m-p/510306#M72984</link>
      <description>&lt;P&gt;Can't agree more with Reeza's exquisite response. More than any docs, read through char functions, how you would extract the nums you need to compute the sum.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1st extract nums you need( look for functions)&lt;/P&gt;
&lt;P&gt;2nd compute the sum after dividing the seconds num by 60&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Nov 2018 02:38:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Convert-time-duration-given-in-quot-yrs-mons-days-hrs-mins-sec/m-p/510306#M72984</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-11-05T02:38:10Z</dc:date>
    </item>
  </channel>
</rss>

