<?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: How to Display Counts Inside the Graphs Proc Template in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/How-to-Display-Counts-Inside-the-Graphs-Proc-Template/m-p/955281#M25229</link>
    <description>&lt;P&gt;Why not&amp;nbsp; use PROC SGPLOT ? Since your grahic is not too complicated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data cars;
	set sashelp.cars;
	where origin = 'USA' and make in ('Saturn' 'Jeep' 'Mercury');
	output;
run;
data xx;
 make =  'custom';
 origin = 'USA';
Run;
data cars1;
set cars xx;
run;

proc freq data = cars;
 table make/out = freq;
run;
&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;
data cars2;
 merge cars1 freq(keep=make count);
 by make;
run;&lt;/STRONG&gt;&lt;/FONT&gt;

proc template;
  define statgraph boxplot;
    begingraph;
      entrytitle "City Mileage for Vehicle Types";
      layout overlay /
        xaxisopts=(offsetmin=0.1 offsetmax=0.1);
        boxplot y=mpg_city x=make /
          datalabel=make spread=true;

/*		  Wrong in my code what to enter?*/
		innermargin / align=bottom opaque=true backgroundcolor=cxf5f5f5;
         &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt; axistable x=make value=count/ stat=mean 
            valueattrs=(size=9pt weight=bold) labelattrs=(weight=bold)&lt;/STRONG&gt;&lt;/FONT&gt;
            ;

        endinnermargin;



      endlayout;
    endgraph;
  end;
run;
&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;options missing=0;&lt;/STRONG&gt;&lt;/FONT&gt;
proc sgrender &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;data=cars2&lt;/STRONG&gt; &lt;/FONT&gt;template=boxplot;
  label type="Vehicle Type" &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;count='Counts';&lt;/STRONG&gt;&lt;/FONT&gt;
run;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1736231214653.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/103506i333352C33DF519A6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1736231214653.png" alt="Ksharp_0-1736231214653.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 07 Jan 2025 06:27:02 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2025-01-07T06:27:02Z</dc:date>
    <item>
      <title>How to Display Counts Inside the Graphs Proc Template</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-Display-Counts-Inside-the-Graphs-Proc-Template/m-p/955276#M25228</link>
      <description>&lt;P&gt;Hello Community,&lt;/P&gt;&lt;P&gt;I recently started learning SAS, completed my certification, But never exposed to the Graphs before.&amp;nbsp; I got little familar with SGPLOT/ SGPANEL.&amp;nbsp;I am looking to learn proc template.&amp;nbsp; I googled alot and looked on the SAS website I did not got much luck. My professor said, try this website. I am new here , forgive for my mistakes.&amp;nbsp;&lt;/P&gt;&lt;P&gt;My questions is How to display the counts inside the Graph? How to display '0' when there is no count? My case make 'custom' is zero count.&lt;/P&gt;&lt;P&gt;I have the following Graph, I want to display the counts Inside the graph for each make. I see on SAS website to use the Inner margin and axistable options When I tried I am getting Errors. Can you please help how I can achieve this using Proc template. I am not sure how this website work. if I posted in wrong place please forgive me and guide me to right place.&amp;nbsp; Thank you.&lt;/P&gt;&lt;P&gt;Reference Code for inner margin :&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatgraph/p0v5nj3waz75w4n1s2y70echq6im.htm#p08pr1slkds374n14ysbxx1lr3uq" target="_blank" rel="noopener"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatgraph/p0v5nj3waz75w4n1s2y70echq6im.htm#p08pr1slkds374n14ysbxx1lr3uq&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data cars;
	set sashelp.cars;
	where origin = 'USA' and make in ('Saturn' 'Jeep' 'Mercury');
	output;
run;
data xx;
 make =  'custom';
 origin = 'USA';
Run;
data cars1;
set cars xx;
run;

proc freq data = cars;
 table make/out = freq;
run;

proc template;
  define statgraph boxplot;
    begingraph;
      entrytitle "City Mileage for Vehicle Types";
      layout overlay /
        xaxisopts=(offsetmin=0.1 offsetmax=0.1);
        boxplot y=mpg_city x=make /
          datalabel=make spread=true;

/*		  Wrong in my code what to enter?*/
		innermargin / align=bottom opaque=true backgroundcolor=cxf5f5f5;
          axistable x= @@@ value=@@@ / 
            stat=Sum display=(label)
            headerlabel="Counts"
            headerlabelattrs=GraphLabelText
            valueattrs=(size=9pt weight=bold)
            ;
        endinnermargin;
      endlayout;
    endgraph;
  end;
run;

proc sgrender data=cars1 template=boxplot;
  label type="Vehicle Type";
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="StudentSASLearn_0-1736223553077.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/103502iF9131E25564BA0DE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="StudentSASLearn_0-1736223553077.png" alt="StudentSASLearn_0-1736223553077.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="StudentSASLearn_1-1736223592426.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/103503iA9A171E2EDB4BBA3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="StudentSASLearn_1-1736223592426.png" alt="StudentSASLearn_1-1736223592426.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2025 04:21:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-Display-Counts-Inside-the-Graphs-Proc-Template/m-p/955276#M25228</guid>
      <dc:creator>StudentSASLearn</dc:creator>
      <dc:date>2025-01-07T04:21:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to Display Counts Inside the Graphs Proc Template</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-Display-Counts-Inside-the-Graphs-Proc-Template/m-p/955281#M25229</link>
      <description>&lt;P&gt;Why not&amp;nbsp; use PROC SGPLOT ? Since your grahic is not too complicated.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data cars;
	set sashelp.cars;
	where origin = 'USA' and make in ('Saturn' 'Jeep' 'Mercury');
	output;
run;
data xx;
 make =  'custom';
 origin = 'USA';
Run;
data cars1;
set cars xx;
run;

proc freq data = cars;
 table make/out = freq;
run;
&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;
data cars2;
 merge cars1 freq(keep=make count);
 by make;
run;&lt;/STRONG&gt;&lt;/FONT&gt;

proc template;
  define statgraph boxplot;
    begingraph;
      entrytitle "City Mileage for Vehicle Types";
      layout overlay /
        xaxisopts=(offsetmin=0.1 offsetmax=0.1);
        boxplot y=mpg_city x=make /
          datalabel=make spread=true;

/*		  Wrong in my code what to enter?*/
		innermargin / align=bottom opaque=true backgroundcolor=cxf5f5f5;
         &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt; axistable x=make value=count/ stat=mean 
            valueattrs=(size=9pt weight=bold) labelattrs=(weight=bold)&lt;/STRONG&gt;&lt;/FONT&gt;
            ;

        endinnermargin;



      endlayout;
    endgraph;
  end;
run;
&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;options missing=0;&lt;/STRONG&gt;&lt;/FONT&gt;
proc sgrender &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;data=cars2&lt;/STRONG&gt; &lt;/FONT&gt;template=boxplot;
  label type="Vehicle Type" &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;count='Counts';&lt;/STRONG&gt;&lt;/FONT&gt;
run;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1736231214653.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/103506i333352C33DF519A6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1736231214653.png" alt="Ksharp_0-1736231214653.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2025 06:27:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-Display-Counts-Inside-the-Graphs-Proc-Template/m-p/955281#M25229</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-01-07T06:27:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to Display Counts Inside the Graphs Proc Template</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-Display-Counts-Inside-the-Graphs-Proc-Template/m-p/955433#M25230</link>
      <description>&lt;P&gt;You are genius. Thanks. saved lot of time , I was still searching in internet for that like two days..&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2025 21:32:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-Display-Counts-Inside-the-Graphs-Proc-Template/m-p/955433#M25230</guid>
      <dc:creator>StudentSASLearn</dc:creator>
      <dc:date>2025-01-07T21:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to Display Counts Inside the Graphs Proc Template</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-to-Display-Counts-Inside-the-Graphs-Proc-Template/m-p/955436#M25231</link>
      <description>&lt;P&gt;While this does not help with your specific question, if you are new to ODS Graphics, the SG procedures, and the template language, my free book might help.&amp;nbsp; &lt;A href="https://support.sas.com/documentation/prod-p/grstat/9.4/en/PDF/odsbasicg.pdf" target="_blank"&gt;https://support.sas.com/documentation/prod-p/grstat/9.4/en/PDF/odsbasicg.pdf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jan 2025 22:21:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-to-Display-Counts-Inside-the-Graphs-Proc-Template/m-p/955436#M25231</guid>
      <dc:creator>WarrenKuhfeld</dc:creator>
      <dc:date>2025-01-07T22:21:56Z</dc:date>
    </item>
  </channel>
</rss>

