<?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: Hour 0 Qtr_Hr1 =12:15 AM in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Hour-0-Qtr-Hr1-12-15-AM/m-p/324439#M72034</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/115585"&gt;@Scottie_T&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;If you're new to programming then make sure that you understand how SAS deals with dates and times and especially make sure that you understand the difference of how SAS stores Date and Time values internally and how it prints it using formats (and "print" applies also if you just look at your data in a table).&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/69852/HTML/default/viewer.htm#p1wj0wt2ebe2a0n1lv4lem9hdc0v.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrcon/69852/HTML/default/viewer.htm#p1wj0wt2ebe2a0n1lv4lem9hdc0v.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example: It would be possible that your quarter variable actually already stores a SAS time value and that there is just a format to the variable which then prints this time value as quarters. In such a case there wouldn't be any calculations required and you would just assign a different format. There are then also ways to use the formatted values for grouping/summarizations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Above is the reason why most of the case people just store SAS Date, Time and DateTime values and then apply the format which best suits their needs (and if there isn't already an OOTB format then you can also create your own one using Proc Format / Picture ).&lt;/P&gt;</description>
    <pubDate>Fri, 13 Jan 2017 00:03:50 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2017-01-13T00:03:50Z</dc:date>
    <item>
      <title>Hour 0 Qtr_Hr1 =12:15 AM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hour-0-Qtr-Hr1-12-15-AM/m-p/324422#M72024</link>
      <description>&lt;P&gt;I currently have Loc_NO, Trns_Date, Hour, Qtr Hour.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How do I create a variable that reads hours 0 to 23 and Qtr_Hour 1 to 4 and outputs the appropriate time? (12:15 AM, etc)&lt;/P&gt;
&lt;P&gt;Sample code is below the chart.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/6688iE013597D5B6E84E9/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="Time_Chart.jpg" title="Time_Chart.jpg" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc SQL;&lt;BR /&gt;Create Table Work.Shipping_Qtr_Hour_Revenue AS&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Select Loc_No,Trns_Date,Hour,Qtr_Hour,Revenue,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;From Qtr_Hour_Revenue_All&lt;BR /&gt;Group By Loc_No,Trns_Date,Hour,Qtr_Hour&lt;BR /&gt;;&lt;BR /&gt;Quit;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2017 22:42:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hour-0-Qtr-Hr1-12-15-AM/m-p/324422#M72024</guid>
      <dc:creator>Scottie_T</dc:creator>
      <dc:date>2017-01-12T22:42:14Z</dc:date>
    </item>
    <item>
      <title>Re: Hour 0 Qtr_Hr1 =12:15 AM you idiot!!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hour-0-Qtr-Hr1-12-15-AM/m-p/324424#M72025</link>
      <description>&lt;P&gt;I'm not sure who's an idiot but I don't understand your question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you clarify with what you have and what you want? Also, please post data as text, not an image. With an image, if someone want's to provide code they need to not only write the code but write test data. In my books this would be mean I would have to be very interested in the question. There's even an EG task that will do it for you here.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.sas.com/content/sasdummy/2013/01/21/turn-your-data-set-into-a-data-step-program/" target="_blank"&gt;http://blogs.sas.com/content/sasdummy/2013/01/21/turn-your-data-set-into-a-data-step-program/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2017 22:40:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hour-0-Qtr-Hr1-12-15-AM/m-p/324424#M72025</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-01-12T22:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: Hour 0 Qtr_Hr1 =12:15 AM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hour-0-Qtr-Hr1-12-15-AM/m-p/324425#M72026</link>
      <description>&lt;P&gt;I'll guess that you're looking for something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc SQL;&lt;BR /&gt;Create Table Work.Shipping_Qtr_Hour_Revenue AS&lt;BR /&gt; Select Loc_No,Trns_Date,Hour,Qtr_Hour,Revenue,&lt;BR /&gt; input(catt(hour,':',(qtr_hour-1)*15),time5.) as time format=timeampm8.&lt;BR /&gt; From Qtr_Hour_Revenue_All&lt;BR /&gt;Group By Loc_No,Trns_Date,Hour,Qtr_Hour&lt;BR /&gt;;&lt;BR /&gt;Quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, the above slightly deviates from your specs since it treats qtr_Hour 1 as the start and qtr_hour 4 as n:45.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HTH,&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2017 22:47:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hour-0-Qtr-Hr1-12-15-AM/m-p/324425#M72026</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-01-12T22:47:30Z</dc:date>
    </item>
    <item>
      <title>Re: Hour 0 Qtr_Hr1 =12:15 AM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hour-0-Qtr-Hr1-12-15-AM/m-p/324426#M72027</link>
      <description>&lt;P&gt;I think you just want the time from hour and qtr_hour.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Time is measured in seconds so convert everything to the same unit and then display appropriately.&lt;/P&gt;
&lt;P&gt;Or use HMS() function&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lefunctionsref/69762/HTML/default/viewer.htm#n1oc359bvmqub9n1iavw6u3we8oi.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lefunctionsref/69762/HTML/default/viewer.htm#n1oc359bvmqub9n1iavw6u3we8oi.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;These functions can be used in SQL or if using Query Builder then create a computed column.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data test;
input hour qtr_hour;

Time= hour*60*60+qtr_hour*15*60;
time2=hms(hour, qtr_hour*15, 0);
Format time: time8.;

cards;
0 1
0 2
0 3
0 4
1 1
23 2
15 3
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS. 0 Hour and QTR 1 is not 12:15 it's 00:15&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2017 22:48:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hour-0-Qtr-Hr1-12-15-AM/m-p/324426#M72027</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-01-12T22:48:03Z</dc:date>
    </item>
    <item>
      <title>Re: Hour 0 Qtr_Hr1 =12:15 AM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hour-0-Qtr-Hr1-12-15-AM/m-p/324427#M72028</link>
      <description>&lt;P&gt;Reeza,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It was just me being goody with a header and I feel like an adiot with it... lol&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes it will Read as 00:15 once it is programmed and I will replace it with 12:15 Am.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was trying to format variables such as Hour=0 to read as a 12, Hour=1 to read as 1, Qtr_Hour=1 read as 15, qtr_hour=2 read as 30.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So just read the two columns and output the approporate time. Then an AM or PM. I think I have stared at it to long to really know the best way.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for all of your help!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Scottie&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2017 22:53:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hour-0-Qtr-Hr1-12-15-AM/m-p/324427#M72028</guid>
      <dc:creator>Scottie_T</dc:creator>
      <dc:date>2017-01-12T22:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: Hour 0 Qtr_Hr1 =12:15 AM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hour-0-Qtr-Hr1-12-15-AM/m-p/324428#M72029</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/115585"&gt;@Scottie_T&lt;/a&gt;&amp;nbsp;I did remove it because it didn't feel right. If you're set on it being there, feel free to add it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use the appropriate format instead of fighting with AM/PM, change to my code would be:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Format time: timeampm.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Jan 2017 22:56:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hour-0-Qtr-Hr1-12-15-AM/m-p/324428#M72029</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-01-12T22:56:31Z</dc:date>
    </item>
    <item>
      <title>Re: Hour 0 Qtr_Hr1 =12:15 AM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hour-0-Qtr-Hr1-12-15-AM/m-p/324429#M72030</link>
      <description>&lt;P&gt;Reeza &amp;amp; Art,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much for your solutions I will work through these solutions and try them out.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am new to programming so learning as fast as I can.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Scottie&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2017 23:04:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hour-0-Qtr-Hr1-12-15-AM/m-p/324429#M72030</guid>
      <dc:creator>Scottie_T</dc:creator>
      <dc:date>2017-01-12T23:04:02Z</dc:date>
    </item>
    <item>
      <title>Re: Hour 0 Qtr_Hr1 =12:15 AM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hour-0-Qtr-Hr1-12-15-AM/m-p/324435#M72032</link>
      <description>&lt;P&gt;Time = hms(hour, qtr_hour*15,0); in a data step&lt;/P&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;P&gt;&amp;nbsp;hms(hour, qtr_hour*15,0) as Time in proc SQL&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However you will want to assign a FORMAT to display the value as hh:MM such as TIME5.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Jan 2017 23:56:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hour-0-Qtr-Hr1-12-15-AM/m-p/324435#M72032</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-01-12T23:56:08Z</dc:date>
    </item>
    <item>
      <title>Re: Hour 0 Qtr_Hr1 =12:15 AM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hour-0-Qtr-Hr1-12-15-AM/m-p/324439#M72034</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/115585"&gt;@Scottie_T&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;If you're new to programming then make sure that you understand how SAS deals with dates and times and especially make sure that you understand the difference of how SAS stores Date and Time values internally and how it prints it using formats (and "print" applies also if you just look at your data in a table).&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/69852/HTML/default/viewer.htm#p1wj0wt2ebe2a0n1lv4lem9hdc0v.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrcon/69852/HTML/default/viewer.htm#p1wj0wt2ebe2a0n1lv4lem9hdc0v.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example: It would be possible that your quarter variable actually already stores a SAS time value and that there is just a format to the variable which then prints this time value as quarters. In such a case there wouldn't be any calculations required and you would just assign a different format. There are then also ways to use the formatted values for grouping/summarizations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Above is the reason why most of the case people just store SAS Date, Time and DateTime values and then apply the format which best suits their needs (and if there isn't already an OOTB format then you can also create your own one using Proc Format / Picture ).&lt;/P&gt;</description>
      <pubDate>Fri, 13 Jan 2017 00:03:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hour-0-Qtr-Hr1-12-15-AM/m-p/324439#M72034</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-01-13T00:03:50Z</dc:date>
    </item>
    <item>
      <title>Re: Hour 0 Qtr_Hr1 =12:15 AM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hour-0-Qtr-Hr1-12-15-AM/m-p/324461#M72044</link>
      <description>&lt;P&gt;Build on this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc SQL;
Create Table Work.Shipping_Qtr_Hour_Revenue AS
Select 
    Loc_No,
    Trns_Date,
    Hour,
    Qtr_Hour,
    hour*'01:00:00't + qtr_hour*'00:15:00't as time format=timeAMPM8.,
    Revenue,
From Qtr_Hour_Revenue_All
Group By Loc_No, Trns_Date, Hour, Qtr_Hour;
Quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Jan 2017 05:24:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hour-0-Qtr-Hr1-12-15-AM/m-p/324461#M72044</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-01-13T05:24:34Z</dc:date>
    </item>
  </channel>
</rss>

