<?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: Customizing the width of hbar sgplot in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Customizing-the-width-of-hbar-sgplot/m-p/407250#M13910</link>
    <description>&lt;P&gt;There is no way to set a fixed bar width that will apply to all cases.&amp;nbsp; SG computes such things outside in, not inside out.&amp;nbsp; When there is only one category, the computations are a bit different.&amp;nbsp; We can look into it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, If you know you have a one category situation, you can try setting the offsetmin and offsetmax on the category axis to reduce the bar width.&amp;nbsp; yaxis offsetmin=0.3 offsetmax=0.3;&lt;/P&gt;</description>
    <pubDate>Wed, 25 Oct 2017 13:21:25 GMT</pubDate>
    <dc:creator>Jay54</dc:creator>
    <dc:date>2017-10-25T13:21:25Z</dc:date>
    <item>
      <title>Customizing the width of hbar sgplot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Customizing-the-width-of-hbar-sgplot/m-p/407196#M13908</link>
      <description>&lt;P&gt;I have plotted hbar chart with sgplot for different customers. The problem I have is if the plot has more than 1 bar the widths are okay but if the plot outputs only one bar the width becomes double. Is there any way I can make the width fixed no matter the number of bars created. I have already used the hbar statement barwidth=0.8 but this is not helping. I will appreciate any help. Thanks in advance&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 10:43:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Customizing-the-width-of-hbar-sgplot/m-p/407196#M13908</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2017-10-25T10:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: Customizing the width of hbar sgplot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Customizing-the-width-of-hbar-sgplot/m-p/407250#M13910</link>
      <description>&lt;P&gt;There is no way to set a fixed bar width that will apply to all cases.&amp;nbsp; SG computes such things outside in, not inside out.&amp;nbsp; When there is only one category, the computations are a bit different.&amp;nbsp; We can look into it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, If you know you have a one category situation, you can try setting the offsetmin and offsetmax on the category axis to reduce the bar width.&amp;nbsp; yaxis offsetmin=0.3 offsetmax=0.3;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 13:21:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Customizing-the-width-of-hbar-sgplot/m-p/407250#M13910</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2017-10-25T13:21:25Z</dc:date>
    </item>
    <item>
      <title>Re: Customizing the width of hbar sgplot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Customizing-the-width-of-hbar-sgplot/m-p/407454#M13918</link>
      <description>&lt;P&gt;Okay, thanks a lot. I will try that and let you know the outcome&lt;/P&gt;&lt;P&gt;I have the offsetmin and offsetmax set to 0.05 does that have any influence on the width of the bars?&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token statement"&gt;yaxis&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;display&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;nolabel&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; offsetmin&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;0.05&lt;/SPAN&gt; offsetmax&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;0.05&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2017 20:19:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Customizing-the-width-of-hbar-sgplot/m-p/407454#M13918</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2017-10-25T20:19:26Z</dc:date>
    </item>
    <item>
      <title>Re: Customizing the width of hbar sgplot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Customizing-the-width-of-hbar-sgplot/m-p/411080#M14095</link>
      <description>&lt;P&gt;Hello Sanjay,&lt;/P&gt;&lt;P&gt;sorry I was on holidays. I came back today and tried your suggestion but it didn't work. Is there any other way I can adjust the width?&lt;/P&gt;&lt;P&gt;I will be glad if any one can help.&lt;/P&gt;&lt;P&gt;Am just thinking of using if statement. To say if number of bars less than 4 then width=? else width =?&lt;/P&gt;&lt;P&gt;but I haven't tried that yet.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2017 07:51:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Customizing-the-width-of-hbar-sgplot/m-p/411080#M14095</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2017-11-07T07:51:47Z</dc:date>
    </item>
    <item>
      <title>Re: Customizing the width of hbar sgplot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Customizing-the-width-of-hbar-sgplot/m-p/411290#M14103</link>
      <description>&lt;P&gt;If you share your program with sample data, it is easier for others to help.&amp;nbsp;&amp;nbsp;"Did not work" does not provide much information.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Nov 2017 18:09:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Customizing-the-width-of-hbar-sgplot/m-p/411290#M14103</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2017-11-07T18:09:56Z</dc:date>
    </item>
    <item>
      <title>Re: Customizing the width of hbar sgplot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Customizing-the-width-of-hbar-sgplot/m-p/413307#M14188</link>
      <description>&lt;P&gt;Hi Sanjay;&lt;/P&gt;&lt;P&gt;sorry for repling so late. I was a little bit busy with some other issues. Here is the code for Program. The problem is that the width decreases with the number of bars. I do not want that, I want the width to be fix no matter the number of bars. I hope you can help.&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import datafile= "saslibrary\test1.xls" out=test
dbms=xls replace;
getnames=yes;
run;
%macro report ();
%do i = 501 %to 505 ;

proc sgplot data=test  pad=(bottom=5%);
styleattrs datacolors=(red);

yaxis grid type=discrete discreteorder=data;
 
hbar sport_typ /response=count
                   barwidth=0.8 missing datalabel = count;
      
yaxis display=(nolabel) offsetmin=0.05 offsetmax=0.05;
xaxis label='Number of Athletes' grid offsetmin=0.0 offsetmax=0.05;
where rep_id = &amp;amp;i;

 run;
title " ";

%end;

%mend report;
%report ();&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 14 Nov 2017 13:02:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Customizing-the-width-of-hbar-sgplot/m-p/413307#M14188</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2017-11-14T13:02:04Z</dc:date>
    </item>
    <item>
      <title>Re: Customizing the width of hbar sgplot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Customizing-the-width-of-hbar-sgplot/m-p/413314#M14189</link>
      <description>&lt;P&gt;A few things. Like in many other SAS programs, you do not need a macro. Sort your data by rep_id&amp;nbsp;and use a BY statement in PROC SGPLOT instead as in this small example&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=sashelp.class;
	by sex;
run;

proc sgplot data=sashelp.class;
	by sex;
	scatter x=height y=weight;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I don't think it is possible to fix a bar width, so it does not change with the number of bars in your plot. As the documentation states, the BARWIDTH statement "&lt;SPAN class="xis-shortDescription"&gt;specifies the width of the bars as a ratio of the maximum possible width". &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2017 13:33:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Customizing-the-width-of-hbar-sgplot/m-p/413314#M14189</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-11-14T13:33:09Z</dc:date>
    </item>
    <item>
      <title>Re: Customizing the width of hbar sgplot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Customizing-the-width-of-hbar-sgplot/m-p/413318#M14191</link>
      <description>&lt;P&gt;Please see my previous answer to this question.&amp;nbsp; "&lt;SPAN&gt;There is no way to set a fixed bar width that will apply to all cases.&amp;nbsp; SG computes such things outside in, not inside out."&amp;nbsp; For a set graph size, the bar width will depend on the number of bars in the graph.&amp;nbsp; More bars -&amp;gt; less bar width.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2017 13:44:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Customizing-the-width-of-hbar-sgplot/m-p/413318#M14191</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2017-11-14T13:44:41Z</dc:date>
    </item>
    <item>
      <title>Re: Customizing the width of hbar sgplot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Customizing-the-width-of-hbar-sgplot/m-p/413461#M14197</link>
      <description>&lt;P&gt;ok thanks for your reply&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2017 20:17:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Customizing-the-width-of-hbar-sgplot/m-p/413461#M14197</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2017-11-14T20:17:45Z</dc:date>
    </item>
    <item>
      <title>Re: Customizing the width of hbar sgplot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Customizing-the-width-of-hbar-sgplot/m-p/413462#M14198</link>
      <description>&lt;P&gt;okay Sanjay, thanks for that&lt;/P&gt;</description>
      <pubDate>Tue, 14 Nov 2017 20:18:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Customizing-the-width-of-hbar-sgplot/m-p/413462#M14198</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2017-11-14T20:18:57Z</dc:date>
    </item>
  </channel>
</rss>

