<?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: Plot totals given time intervals in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Plot-totals-given-time-intervals/m-p/305836#M20728</link>
    <description>&lt;P&gt;This solution definitely has the right idea.&lt;/P&gt;&lt;P&gt;This is&amp;nbsp;the data set (after sorting) that was produced from your code.&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/5376iDCDAE3D1C6C0DD11/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="SASexample2.PNG" title="SASexample2.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let's say each two timestamp represents an interval we want to examine. &amp;nbsp;So for example, for ID 123, (1/10, 1/14) is the first interval, (1/15, 1/17) is the second interval, and so on. &amp;nbsp;According to this rule, on 1/11 there should be 5 counts of unique ID numbers (123, 124, 125, 126, and 127--NOT 128). &amp;nbsp;I basically want this count reflected on the graph.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the graph that was produced from the data set:&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/5377iFF263A21ABA9B3E9/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="SASexample3.PNG" title="SASexample3.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know if I'm making this more complicated than it should be....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's okay if there is no straightforward solution. &amp;nbsp;Suggestions are still appreciated. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 20 Oct 2016 00:41:54 GMT</pubDate>
    <dc:creator>trishaechual</dc:creator>
    <dc:date>2016-10-20T00:41:54Z</dc:date>
    <item>
      <title>Plot totals given time intervals</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Plot-totals-given-time-intervals/m-p/305708#M20716</link>
      <description>&lt;P&gt;This is my first time posting here, and I'm fairly new to SAS... and I couldn't find another question about this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically I have a data set with a list of ID numbers. &amp;nbsp;Each ID number has timestamps listed after it. &amp;nbsp;For example:&lt;/P&gt;&lt;P&gt;000134 &amp;nbsp; &amp;nbsp; 1/1/2016 4:53 AM &amp;nbsp; &amp;nbsp; 2/3/2016 5:01 PM &amp;nbsp; &amp;nbsp; 5/12/2016 3:12 PM &amp;nbsp; &amp;nbsp; 6/1/2016 6:12 AM&lt;/P&gt;&lt;P&gt;000135 &amp;nbsp; &amp;nbsp; 1/2/2016 11:04 AM &amp;nbsp; 1/15/2016 5:51 AM&lt;/P&gt;&lt;P&gt;000136 &amp;nbsp; &amp;nbsp; 1/1/2016 5:41 AM &amp;nbsp; &amp;nbsp; 2/17/2016 1:29 PM&lt;/P&gt;&lt;P&gt;: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;:&lt;/P&gt;&lt;P&gt;: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;:&lt;/P&gt;&lt;P&gt;: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;:&lt;/P&gt;&lt;P&gt;: &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;Each timestamp signifies something about the ID number (i.e. "statuses") . &amp;nbsp;What I want to do is plot the total number of IDs that fall in the same time interval, producing a time vs sum graph. &amp;nbsp;For example, in the above sample data, for 1/1/2016, I would plot 2 totals. &amp;nbsp;From 1/2/2106 to 1/14/2016, I would plot 3 totals. &amp;nbsp;From 1/15/2016 to 2/3/2016 I would plot 2, and from 2/4/2016 to 2/17/2016 I would only plot 1 total. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this possible in SAS EG?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2016 16:36:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Plot-totals-given-time-intervals/m-p/305708#M20716</guid>
      <dc:creator>trishaechual</dc:creator>
      <dc:date>2016-10-19T16:36:05Z</dc:date>
    </item>
    <item>
      <title>Re: Plot totals given time intervals</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Plot-totals-given-time-intervals/m-p/305767#M20723</link>
      <description>&lt;P&gt;First thing is to confirm that your data is already a&amp;nbsp;SAS data set.&lt;/P&gt;
&lt;P&gt;Next would be to verify that the&amp;nbsp;time stamps are actually SAS datetime values. Proc contents or table properties should tell you that the variables are numeric with a format that may be something like DATETIME20. You want datetime or date and time valued variables so that the concept of time interval makes some sense.&lt;/P&gt;
&lt;P&gt;If you have a varying number of stamps what do the variable names look like?&lt;/P&gt;
&lt;P&gt;The next step would be make the data look like&lt;/P&gt;
&lt;P&gt;Id&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TimeStamp&lt;/P&gt;
&lt;P&gt;000134&amp;nbsp;&amp;nbsp;1/1/2016 4:53 AM&lt;/P&gt;
&lt;P&gt;000134&amp;nbsp;&amp;nbsp;&amp;nbsp;2/3/2016 5:01 PM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;000134&amp;nbsp; &amp;nbsp;5/12/2016 3:12 PM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Which will allow you to summarize counts on the date value of the time stamp.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc freq with the time stamp varible and a suitable format would get the counts and may generate a plot you like.&lt;/P&gt;
&lt;P&gt;Or summarize with&amp;nbsp;counts of the times&amp;nbsp;stamp and then send to a&amp;nbsp;plotting procedure.&amp;nbsp;If you have lots of dates you might look for a NEEDLE plot.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2016 20:18:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Plot-totals-given-time-intervals/m-p/305767#M20723</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-10-19T20:18:08Z</dc:date>
    </item>
    <item>
      <title>Re: Plot totals given time intervals</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Plot-totals-given-time-intervals/m-p/305779#M20724</link>
      <description>&lt;P&gt;Thank you ballardw.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically the x-axis of my theoretical graph&amp;nbsp;is continuous in time or descrete in intervals of 24 hours. &amp;nbsp;I thought about&amp;nbsp;using Proc Freq to sum the same dates (reformat the data&amp;nbsp;to just date and exclude time), but how would i account for days in between 2 timestamps?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, in the following:&lt;/P&gt;&lt;P&gt;Id&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TimeStamp&lt;/P&gt;&lt;P&gt;000134 &amp;nbsp; 1/1/2016&lt;/P&gt;&lt;P&gt;000134&amp;nbsp;&amp;nbsp;&amp;nbsp;2/3/2016&amp;nbsp;&lt;/P&gt;&lt;P&gt;000134&amp;nbsp; &amp;nbsp;5/12/2016&amp;nbsp;&lt;/P&gt;&lt;P&gt;000135 &amp;nbsp; 1/9/2016&amp;nbsp;&lt;/P&gt;&lt;P&gt;000135 &amp;nbsp; 1/29/2016&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How would I account for plotting the count on 1/15/2016, which would have 2 totals (1/1 to 2/3 for 000134 and 1/9 to 1/29 for 000135)? &amp;nbsp;Hopefully I'm making sense here.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2016 20:44:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Plot-totals-given-time-intervals/m-p/305779#M20724</guid>
      <dc:creator>trishaechual</dc:creator>
      <dc:date>2016-10-19T20:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: Plot totals given time intervals</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Plot-totals-given-time-intervals/m-p/305829#M20727</link>
      <description>&lt;P&gt;How would you like to account for them? The graphing procedures do not need a value for every date in an interval.&lt;/P&gt;
&lt;P&gt;Here's a data simulation that generates a set, summarizes a count by date and graphs it.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data example;
   do id = 123 to 128;
      rancount = ceil(ranuni(123)*20);
      do j= 1 to rancount;
         date = '01JAN2016'd + ceil(ranuni(456)*70);
         output;
      end;
   end;
   drop rancount  j;
   format date mmddyy10.;
run;

proc freq data=example noprint;
   tables date/ out=datecount;
run;

proc sgplot data=datecount;
   scatter x=date y=count;
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This should generate some gaps in the dates. Most of the dates with data are likely to only have 1 or 2 counts but&amp;nbsp; you should get a few 3s and 4s.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You would have to investigate axis control statements for different axis appearance.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Oct 2016 23:59:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Plot-totals-given-time-intervals/m-p/305829#M20727</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-10-19T23:59:05Z</dc:date>
    </item>
    <item>
      <title>Re: Plot totals given time intervals</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Plot-totals-given-time-intervals/m-p/305836#M20728</link>
      <description>&lt;P&gt;This solution definitely has the right idea.&lt;/P&gt;&lt;P&gt;This is&amp;nbsp;the data set (after sorting) that was produced from your code.&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/5376iDCDAE3D1C6C0DD11/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="SASexample2.PNG" title="SASexample2.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let's say each two timestamp represents an interval we want to examine. &amp;nbsp;So for example, for ID 123, (1/10, 1/14) is the first interval, (1/15, 1/17) is the second interval, and so on. &amp;nbsp;According to this rule, on 1/11 there should be 5 counts of unique ID numbers (123, 124, 125, 126, and 127--NOT 128). &amp;nbsp;I basically want this count reflected on the graph.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the graph that was produced from the data set:&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/5377iFF263A21ABA9B3E9/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="SASexample3.PNG" title="SASexample3.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know if I'm making this more complicated than it should be....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's okay if there is no straightforward solution. &amp;nbsp;Suggestions are still appreciated. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Oct 2016 00:41:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Plot-totals-given-time-intervals/m-p/305836#M20728</guid>
      <dc:creator>trishaechual</dc:creator>
      <dc:date>2016-10-20T00:41:54Z</dc:date>
    </item>
  </channel>
</rss>

