<?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: Add mean and N statistics to VBOX PLOT in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Add-mean-and-N-statistics-to-VBOX-PLOT/m-p/926419#M24570</link>
    <description>&lt;P&gt;In order to avoid additional steps, I ended up going with your code adjustment after discussion with my team as this graphic was decided to be sufficient for our purposes. Thank you!&lt;/P&gt;</description>
    <pubDate>Tue, 30 Apr 2024 07:33:01 GMT</pubDate>
    <dc:creator>stodo53</dc:creator>
    <dc:date>2024-04-30T07:33:01Z</dc:date>
    <item>
      <title>Add mean and N statistics to VBOX PLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Add-mean-and-N-statistics-to-VBOX-PLOT/m-p/925762#M24551</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having difficulties adding summary statistics to a box plot in the PROC SGPANEL procedure (ONLY when there is a group variable in the VBOX statement).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;PROC SGPANEL DATA=lvmi;
    PANELBY yearsincetx_grp / ROWS=1;
	WHERE yearsincetx_grp=1 or yearsincetx_grp=2 or yearsincetx_grp=3;
	&lt;FONT color="#FF0000"&gt;VBOX lvmi / CATEGORY=im53 displaystats=(N mean); *CSA;&lt;/FONT&gt;
	ROWAXIS values= (20 to 120 by 10);
	TITLE 'lvmi vs CSA by year';
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This code runs perfectly fine and produces the mean and N observation for each group on the x axis.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="saratodorovic_0-1714053164124.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/95861i524B2A2C4B87E13E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="saratodorovic_0-1714053164124.png" alt="saratodorovic_0-1714053164124.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, when I add sex as a grouping variable, it no longer works. I have tried to troubleshoot and use the COLAXISTABLE statement- to no avail.&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;CODE class=""&gt;PROC SGPANEL DATA=lvmi;
    PANELBY yearsincetx_grp / ROWS=1;
	WHERE yearsincetx_grp=1 or yearsincetx_grp=2 or yearsincetx_grp=3;
	&lt;FONT color="#FF0000"&gt;VBOX lvmi / CATEGORY=im53 GROUP=sex displaystats=(N mean); *CSA;&lt;/FONT&gt;
	ROWAXIS values= (20 to 120 by 10);
	TITLE 'lvmi vs CSA by year and sex';
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;Error code:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="saratodorovic_1-1714053314613.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/95862i0BC56A95DFC57F27/image-size/medium?v=v2&amp;amp;px=400" role="button" title="saratodorovic_1-1714053314613.png" alt="saratodorovic_1-1714053314613.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Which translates to:&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: The DISPLAYSTATS= option is not supported for grouped box plots. The statistics is not created.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So in summary, does anyone know how I can display these statistics (mean, N) when I am using GROUP=sex in the VBOX statement?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sara&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2024 14:00:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Add-mean-and-N-statistics-to-VBOX-PLOT/m-p/925762#M24551</guid>
      <dc:creator>stodo53</dc:creator>
      <dc:date>2024-04-25T14:00:05Z</dc:date>
    </item>
    <item>
      <title>Re: Add mean and N statistics to VBOX PLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Add-mean-and-N-statistics-to-VBOX-PLOT/m-p/925765#M24552</link>
      <description>&lt;P&gt;There is no need, and indeed reasons not to, make pictures of the log. It should be easier to copy log text and then on the forum open a text box, to preserve formatting, and then paste the text.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One reason with text is then we can copy bits out and provide details about what specific messages may mean in context.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/kb/56/520.html" target="_blank"&gt;https://support.sas.com/kb/56/520.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Shows an example that uses additional variables added to the plot data set instead of attempting to plot the statistics using Displaystat to do so. The Colaxistable is restricted to Sum and Mean stats for Vbox (and many other plot types) so would need something other than the Stat options anyway.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2024 14:26:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Add-mean-and-N-statistics-to-VBOX-PLOT/m-p/925765#M24552</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-04-25T14:26:05Z</dc:date>
    </item>
    <item>
      <title>Re: Add mean and N statistics to VBOX PLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Add-mean-and-N-statistics-to-VBOX-PLOT/m-p/925784#M24553</link>
      <description>&lt;P&gt;You can work around this limitation by calculating the N and MEAN externally and using an AXISTABLE to display the values. Here is an example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=sashelp.heart nway;
class weight_status bp_status sex;
var cholesterol;
output out=table mean=mean n=n;
run;

data merged;
set sashelp.heart table;
run;

proc sgpanel data=merged;
panelby weight_status / novarname;
vbox cholesterol / category=bp_status group=sex;
colaxistable n mean / class=sex classdisplay=cluster
                      colorgroup=sex;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 Apr 2024 14:57:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Add-mean-and-N-statistics-to-VBOX-PLOT/m-p/925784#M24553</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2024-04-25T14:57:36Z</dc:date>
    </item>
    <item>
      <title>Re: Add mean and N statistics to VBOX PLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Add-mean-and-N-statistics-to-VBOX-PLOT/m-p/925925#M24559</link>
      <description>If I was right, you are unable to use option "displaystats=" when you have option "group=", Check its DOC.&lt;BR /&gt;And you could try add SEX into PANELBY statement.&lt;BR /&gt;&lt;BR /&gt;proc sgpanel;&lt;BR /&gt; PANELBY yearsincetx_grp sex/layout=lattice;</description>
      <pubDate>Fri, 26 Apr 2024 02:38:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Add-mean-and-N-statistics-to-VBOX-PLOT/m-p/925925#M24559</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-04-26T02:38:03Z</dc:date>
    </item>
    <item>
      <title>Re: Add mean and N statistics to VBOX PLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Add-mean-and-N-statistics-to-VBOX-PLOT/m-p/925974#M24560</link>
      <description>&lt;P&gt;Thanks for your reply! This works for adding in those statistics. However, my graph doesn't have the same formatting when I remove the grouping option for sex. See below.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="saratodorovic_0-1714123858606.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/95918iCEAC55A7781BE50B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="saratodorovic_0-1714123858606.png" alt="saratodorovic_0-1714123858606.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;What I am getting from the adjusted code (no grouping variable for sex):&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="saratodorovic_1-1714123889646.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/95919i7E2B902266F763D2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="saratodorovic_1-1714123889646.png" alt="saratodorovic_1-1714123889646.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2024 09:32:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Add-mean-and-N-statistics-to-VBOX-PLOT/m-p/925974#M24560</guid>
      <dc:creator>stodo53</dc:creator>
      <dc:date>2024-04-26T09:32:57Z</dc:date>
    </item>
    <item>
      <title>Re: Add mean and N statistics to VBOX PLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Add-mean-and-N-statistics-to-VBOX-PLOT/m-p/925978#M24561</link>
      <description>Yeah. That is what supposed to do.&lt;BR /&gt;Did you try &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15130"&gt;@DanH_sas&lt;/a&gt;  code ?</description>
      <pubDate>Fri, 26 Apr 2024 09:41:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Add-mean-and-N-statistics-to-VBOX-PLOT/m-p/925978#M24561</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-04-26T09:41:28Z</dc:date>
    </item>
    <item>
      <title>Re: Add mean and N statistics to VBOX PLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Add-mean-and-N-statistics-to-VBOX-PLOT/m-p/926419#M24570</link>
      <description>&lt;P&gt;In order to avoid additional steps, I ended up going with your code adjustment after discussion with my team as this graphic was decided to be sufficient for our purposes. Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 30 Apr 2024 07:33:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Add-mean-and-N-statistics-to-VBOX-PLOT/m-p/926419#M24570</guid>
      <dc:creator>stodo53</dc:creator>
      <dc:date>2024-04-30T07:33:01Z</dc:date>
    </item>
  </channel>
</rss>

