<?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: Need to create  a graph for time values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Need-to-create-a-graph-for-time-values/m-p/941533#M369375</link>
    <description>&lt;P&gt;Thank you so much it works&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 28 Aug 2024 17:50:05 GMT</pubDate>
    <dc:creator>kajal_30</dc:creator>
    <dc:date>2024-08-28T17:50:05Z</dc:date>
    <item>
      <title>Need to create  a graph for time values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-create-a-graph-for-time-values/m-p/940898#M369264</link>
      <description>&lt;P&gt;I have a column datetime in sas dataset and want to create a graphs to show maximum number of times exists in a range .&lt;/P&gt;&lt;P&gt;For eg few events occur between 2pm and 4 pm so my graph should show maximum dots or peak line during that interval.&lt;/P&gt;&lt;P&gt;max&amp;nbsp; range for the graph should be 24 hours and each interval should be 1 hour apart.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also from the datetime column I just need to take time portion.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;kajal&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2024 18:55:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-create-a-graph-for-time-values/m-p/940898#M369264</guid>
      <dc:creator>kajal_30</dc:creator>
      <dc:date>2024-08-26T18:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: Need to create  a graph for time values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-create-a-graph-for-time-values/m-p/940899#M369265</link>
      <description>&lt;P&gt;A bunch of questions enter my mind:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You say: "&lt;SPAN&gt;want to create a graphs to show maximum number of times exists in a range". Maximum of what? If you take the word "maximum" out of your statement, then it makes sense to me what (I think) you want, you want the number of times this variable exists in the range. But I'm guessing.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You say "&lt;SPAN&gt;For eg few events occur between 2pm and 4 pm so my graph should show maximum dots or peak line during that interval." If there are few events, should that not be the minimum dots or lowest value on the line?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Are these always 2 hour intervals? Are we talking about multiple days, or just talking about time interval regardless of day?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2024 19:00:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-create-a-graph-for-time-values/m-p/940899#M369265</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-08-26T19:00:54Z</dc:date>
    </item>
    <item>
      <title>Re: Need to create  a graph for time values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-create-a-graph-for-time-values/m-p/940900#M369266</link>
      <description>&lt;P&gt;sorry correction to my question.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;need to create a graph showing max frequencies of 'time of event '&amp;nbsp; in a particular time range&amp;nbsp;&lt;/P&gt;&lt;P&gt;most of the events occur between 2pm and 4 pm should show maximum dots on the graph between 2pm and 4 pm range.&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;kajal&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2024 19:02:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-create-a-graph-for-time-values/m-p/940900#M369266</guid>
      <dc:creator>kajal_30</dc:creator>
      <dc:date>2024-08-26T19:02:34Z</dc:date>
    </item>
    <item>
      <title>Re: Need to create  a graph for time values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-create-a-graph-for-time-values/m-p/940901#M369267</link>
      <description>&lt;P&gt;I'm still not understanding your usage of "maximum" in your problem statement. Please explain in more detail.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please show us a simple example, show us some example data and the plot you want.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2024 19:05:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-create-a-graph-for-time-values/m-p/940901#M369267</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-08-26T19:05:20Z</dc:date>
    </item>
    <item>
      <title>Re: Need to create  a graph for time values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-create-a-graph-for-time-values/m-p/940905#M369268</link>
      <description>&lt;P&gt;In a data step the TIMEPART function will extract the time of day from a DATETIME value. Example;&lt;/P&gt;
&lt;PRE&gt;data want;
   set have;
   timeofday = timepart(datetimevariable);
run;&lt;/PRE&gt;
&lt;P&gt;By "each interval should be 1 hour " do you mean the tick marks on the time axis or the actual values of the time rounded to 1 hour to graph, or both?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is going on the Y axis? A count of something? A measurement or recorded value?&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2024 19:23:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-create-a-graph-for-time-values/m-p/940905#M369268</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-08-26T19:23:21Z</dc:date>
    </item>
    <item>
      <title>Re: Need to create  a graph for time values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-create-a-graph-for-time-values/m-p/940907#M369269</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="graph.JPG" style="width: 693px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/99631i1C7F6F687E71A771/image-size/large?v=v2&amp;amp;px=999" role="button" title="graph.JPG" alt="graph.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2024 19:24:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-create-a-graph-for-time-values/m-p/940907#M369269</guid>
      <dc:creator>kajal_30</dc:creator>
      <dc:date>2024-08-26T19:24:28Z</dc:date>
    </item>
    <item>
      <title>Re: Need to create  a graph for time values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-create-a-graph-for-time-values/m-p/940908#M369270</link>
      <description>&lt;P&gt;Thanks for the plot. So we are not calculating a maximum of anything, we are calculating a count. Is that correct?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* UNTESTED CODE AS I DON"T HAVE EXAMPLE DATA */

data have2;
    set have;
    hour=hour(yourdatetimevariable);
run;
proc freq data=have2;
    table hour/noprint out=_counts_;
run;
proc sgplot data=_counts_;
     series x=hour y=count;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Aug 2024 19:32:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-create-a-graph-for-time-values/m-p/940908#M369270</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-08-26T19:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: Need to create  a graph for time values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-create-a-graph-for-time-values/m-p/940942#M369276</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
call streaminit(123);
do datetime=dhms('01jan2022'd,21,0,0) to dhms('02jan2022'd,3,0,0) by 60*60;
 hour=scan(put(timepart(datetime),timeampm.),1,':');
 count=rand('integer',100,600);
 output;
end;
format datetime e8601dt.;
run;

proc sgplot data=have;
series x=hour y=count;
xaxis  type=discrete discreteorder=data label='Time';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1724723165974.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/99638i9C57BD097D7AEEEA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1724723165974.png" alt="Ksharp_0-1724723165974.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2024 01:46:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-create-a-graph-for-time-values/m-p/940942#M369276</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-08-27T01:46:30Z</dc:date>
    </item>
    <item>
      <title>Re: Need to create  a graph for time values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-create-a-graph-for-time-values/m-p/940974#M369289</link>
      <description>&lt;P&gt;If you want this smooth plot, you need points between the hours. Do you have that detail? How many points?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Mind that the more points, the less volume by point. So if the volume is say 600 in an hour, a per-minute plot will show around 10 on the Y axis.&lt;/P&gt;
&lt;P&gt;A per-30-minute plot will show around 300 on the Y axis. Etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Aug 2024 06:57:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-create-a-graph-for-time-values/m-p/940974#M369289</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2024-08-27T06:57:36Z</dc:date>
    </item>
    <item>
      <title>Re: Need to create  a graph for time values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-create-a-graph-for-time-values/m-p/941533#M369375</link>
      <description>&lt;P&gt;Thank you so much it works&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2024 17:50:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-create-a-graph-for-time-values/m-p/941533#M369375</guid>
      <dc:creator>kajal_30</dc:creator>
      <dc:date>2024-08-28T17:50:05Z</dc:date>
    </item>
    <item>
      <title>Re: Need to create  a graph for time values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-create-a-graph-for-time-values/m-p/941534#M369376</link>
      <description>&lt;P&gt;Thank you so much it also works&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2024 17:50:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-create-a-graph-for-time-values/m-p/941534#M369376</guid>
      <dc:creator>kajal_30</dc:creator>
      <dc:date>2024-08-28T17:50:43Z</dc:date>
    </item>
  </channel>
</rss>

