<?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 impute zeroes when plotting frequencies with time axis in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/impute-zeroes-when-plotting-frequencies-with-time-axis/m-p/486421#M16758</link>
    <description>&lt;P&gt;I'm using PROC SGPLOT VLINE statement to make a series plot that plots the frequency of an event over time (by month).&amp;nbsp; Events are sparse, so some months have no events&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Given data like below (two failures in January, one failure in February, three failures in March, one failure in June).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
input FailDate mmddyy10.;
cards ;
1/1/2018
1/2/2018
2/1/2018
3/1/2018
3/2/2018
3/3/2018
6/1/2018
;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm plotting like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=have;
&amp;nbsp; xaxis type=time interval=month ;
&amp;nbsp; vline FailDate / stat=freq markers;
&amp;nbsp; format FailDate yymon. ;
run ;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The resulting plot shows four points (Jan, Feb, Mar, Jun).&amp;nbsp; I would like it to show zeroes for April and May, because there were no events.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It feels like there should an easy way to do this?&amp;nbsp; SAS knows that it has a time axis, and it knows it's counting FailDate by month.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there isn't an easy way I know I can calculate the counts myself, and then force in rows with count=0 and then user a series plot to plot the line.&amp;nbsp; But I'd be happy if there were some option like how PROC TABULATE can use preloadfmt order=data missing=0 to force in zeroes&amp;nbsp;for empty categories.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In reality I'll have a spaghetti plot, with one line for each group.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 13 Aug 2018 17:32:53 GMT</pubDate>
    <dc:creator>Quentin</dc:creator>
    <dc:date>2018-08-13T17:32:53Z</dc:date>
    <item>
      <title>impute zeroes when plotting frequencies with time axis</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/impute-zeroes-when-plotting-frequencies-with-time-axis/m-p/486421#M16758</link>
      <description>&lt;P&gt;I'm using PROC SGPLOT VLINE statement to make a series plot that plots the frequency of an event over time (by month).&amp;nbsp; Events are sparse, so some months have no events&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Given data like below (two failures in January, one failure in February, three failures in March, one failure in June).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
input FailDate mmddyy10.;
cards ;
1/1/2018
1/2/2018
2/1/2018
3/1/2018
3/2/2018
3/3/2018
6/1/2018
;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm plotting like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=have;
&amp;nbsp; xaxis type=time interval=month ;
&amp;nbsp; vline FailDate / stat=freq markers;
&amp;nbsp; format FailDate yymon. ;
run ;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The resulting plot shows four points (Jan, Feb, Mar, Jun).&amp;nbsp; I would like it to show zeroes for April and May, because there were no events.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It feels like there should an easy way to do this?&amp;nbsp; SAS knows that it has a time axis, and it knows it's counting FailDate by month.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there isn't an easy way I know I can calculate the counts myself, and then force in rows with count=0 and then user a series plot to plot the line.&amp;nbsp; But I'd be happy if there were some option like how PROC TABULATE can use preloadfmt order=data missing=0 to force in zeroes&amp;nbsp;for empty categories.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In reality I'll have a spaghetti plot, with one line for each group.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Aug 2018 17:32:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/impute-zeroes-when-plotting-frequencies-with-time-axis/m-p/486421#M16758</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2018-08-13T17:32:53Z</dc:date>
    </item>
    <item>
      <title>Re: impute zeroes when plotting frequencies with time axis</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/impute-zeroes-when-plotting-frequencies-with-time-axis/m-p/486449#M16761</link>
      <description>&lt;P&gt;Add some dates to the data for those months, summarize something to get counts and use a different statistic such as sum and/or the Freq= variablename&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 13 Aug 2018 19:30:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/impute-zeroes-when-plotting-frequencies-with-time-axis/m-p/486449#M16761</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-08-13T19:30:19Z</dc:date>
    </item>
  </channel>
</rss>

