<?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: Average Variable by Hour Over Multiple Days in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Average-Variable-by-Hour-Over-Multiple-Days/m-p/454061#M29265</link>
    <description>&lt;P&gt;When I use the following code, hour in the table does not change (stays at 185).&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA P_sort;
	set LIB.W_W_HOURLY;
	hour = hour(datepart(time));
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;How can this be fixed? I apologize for my limited knowledge of SAS.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 13 Apr 2018 20:51:44 GMT</pubDate>
    <dc:creator>acloseCC</dc:creator>
    <dc:date>2018-04-13T20:51:44Z</dc:date>
    <item>
      <title>Average Variable by Hour Over Multiple Days</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Average-Variable-by-Hour-Over-Multiple-Days/m-p/452974#M29220</link>
      <description>&lt;P&gt;I have been given the following data called P_sort: (small portion of it)&lt;BR /&gt;assoc_count&amp;nbsp; ...&amp;nbsp; &amp;nbsp; time&lt;BR /&gt;5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;18JUL2017:23:59:59.0000000&lt;BR /&gt;9&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;19JUL2017:02:59:59.0000000&lt;BR /&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;19JUL2017:05:59:59.0000000&lt;BR /&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;19JUL2017:08:59:59.0000000&lt;BR /&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;19JUL2017:11:59:59.0000000&lt;BR /&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;19JUL2017:14:59:59.0000000&lt;BR /&gt;4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;19JUL2017:17:59:59.0000000&lt;BR /&gt;9&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;19JUL2017:20:59:59.0000000&lt;BR /&gt;10&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;19JUL2017:23:59:59.0000000&lt;BR /&gt;15&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;20JUL2017:02:59:59.0000000&lt;/P&gt;&lt;P&gt;...&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am tasked with finding an average of the assoc_count per hour over a specified number of weeks. This average will then be displayed with bar charts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My current code is:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc TIMESERIES data=P_sort out=P_sort;
   id time interval=hour
   accumulate=total
   start='018jul2018:00:00:00'dt
   end  ='025jul2018:00:00:00'dt;
   var assoc_count;
run;

/* AVERAGING GOES HERE*/

proc gchart data=P_sort;
	vbar time / sumvar=assoc_count maxis=axis1 raxis=axis2;
run;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;I don't know how to implement this. Any suggestions would be helpful.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2018 22:17:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Average-Variable-by-Hour-Over-Multiple-Days/m-p/452974#M29220</guid>
      <dc:creator>acloseCC</dc:creator>
      <dc:date>2018-04-10T22:17:34Z</dc:date>
    </item>
    <item>
      <title>Re: Average Variable by Hour Over Multiple Days</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Average-Variable-by-Hour-Over-Multiple-Days/m-p/452982#M29221</link>
      <description>&lt;P&gt;In a data step, compute the hour of the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;hour = hour(datepart(time));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then, run PROC SUMMARY on this data set to compute the averages by hour.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2018 22:17:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Average-Variable-by-Hour-Over-Multiple-Days/m-p/452982#M29221</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-04-10T22:17:51Z</dc:date>
    </item>
    <item>
      <title>Re: Average Variable by Hour Over Multiple Days</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Average-Variable-by-Hour-Over-Multiple-Days/m-p/452989#M29223</link>
      <description>&lt;P&gt;What would the "PROC SUMMARY" look like?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2018 22:41:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Average-Variable-by-Hour-Over-Multiple-Days/m-p/452989#M29223</guid>
      <dc:creator>acloseCC</dc:creator>
      <dc:date>2018-04-10T22:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: Average Variable by Hour Over Multiple Days</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Average-Variable-by-Hour-Over-Multiple-Days/m-p/453016#M29224</link>
      <description>&lt;P&gt;There are examples in the PROC SUMMARY documentation. Give it a try.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2018 00:39:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Average-Variable-by-Hour-Over-Multiple-Days/m-p/453016#M29224</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-04-11T00:39:31Z</dc:date>
    </item>
    <item>
      <title>Re: Average Variable by Hour Over Multiple Days</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Average-Variable-by-Hour-Over-Multiple-Days/m-p/454061#M29265</link>
      <description>&lt;P&gt;When I use the following code, hour in the table does not change (stays at 185).&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA P_sort;
	set LIB.W_W_HOURLY;
	hour = hour(datepart(time));
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;How can this be fixed? I apologize for my limited knowledge of SAS.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Apr 2018 20:51:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Average-Variable-by-Hour-Over-Multiple-Days/m-p/454061#M29265</guid>
      <dc:creator>acloseCC</dc:creator>
      <dc:date>2018-04-13T20:51:44Z</dc:date>
    </item>
    <item>
      <title>Re: Average Variable by Hour Over Multiple Days</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Average-Variable-by-Hour-Over-Multiple-Days/m-p/454228#M29289</link>
      <description>&lt;P&gt;Using DATEPART isn't necessary and it will give you the wrong answer. I think you can use it directly like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA P_sort;
	set LIB.W_W_HOURLY;
	hour = hour(time);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 15 Apr 2018 01:51:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Average-Variable-by-Hour-Over-Multiple-Days/m-p/454228#M29289</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2018-04-15T01:51:10Z</dc:date>
    </item>
    <item>
      <title>Re: Average Variable by Hour Over Multiple Days</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Average-Variable-by-Hour-Over-Multiple-Days/m-p/457051#M29443</link>
      <description>&lt;P&gt;My final solution is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA P_sort;
	set L***;
	hour = hour(time);
run;

proc sql;
	create table selected_P_sort as
	select assoc_count, hour 
	from P_sort
	where datepart(time) between '01APR2018'd and '15APR2018'd AND hour between 7 and 23;
quit;

proc summary data=selected_P_sort;
	var assoc_count;
	class hour;
	output out=fin_P_sort MEAN=;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;Thanks&amp;nbsp;PaigeMiller and SASKiwi.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Apr 2018 20:30:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Average-Variable-by-Hour-Over-Multiple-Days/m-p/457051#M29443</guid>
      <dc:creator>acloseCC</dc:creator>
      <dc:date>2018-04-24T20:30:32Z</dc:date>
    </item>
  </channel>
</rss>

