<?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 Keylegend Elements SGPLOT in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Keylegend-Elements-SGPLOT/m-p/727909#M21177</link>
    <description>&lt;P&gt;Dear all,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a plot that looks like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Anita_n_0-1616251564544.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56188i49E353F59BB3C379/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Anita_n_0-1616251564544.png" alt="Anita_n_0-1616251564544.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I wish to insert the percentages in the graph and the keylegend should just be one or two lines outside the graph. I used across=2 but it isn't working. Any help?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data = mydata dattrmap= myattrmap pad=(bottom=5%) noautolegend noborder;
xaxis grid type=discrete discreteorder=data;
vbar year / response=frequencies group = mygroup attrid=mygroup barwidth=0.9 missing ;
xaxis  display= (nolabel) valueattrs=(family="verdana" size=8pt) fitpolicy=rotate ValuesRotate=Vertical;
yaxis  display= (nolabel) valueattrs=(family="verdana" size=8pt);
keylegend / location=outside position=bottomright across=2 title="" valueattrs=(size=10 family="verdana") outerpad=(top=0.2cm) noborder;
run; &lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 20 Mar 2021 14:51:17 GMT</pubDate>
    <dc:creator>Anita_n</dc:creator>
    <dc:date>2021-03-20T14:51:17Z</dc:date>
    <item>
      <title>Keylegend Elements SGPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Keylegend-Elements-SGPLOT/m-p/727909#M21177</link>
      <description>&lt;P&gt;Dear all,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a plot that looks like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Anita_n_0-1616251564544.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56188i49E353F59BB3C379/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Anita_n_0-1616251564544.png" alt="Anita_n_0-1616251564544.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I wish to insert the percentages in the graph and the keylegend should just be one or two lines outside the graph. I used across=2 but it isn't working. Any help?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data = mydata dattrmap= myattrmap pad=(bottom=5%) noautolegend noborder;
xaxis grid type=discrete discreteorder=data;
vbar year / response=frequencies group = mygroup attrid=mygroup barwidth=0.9 missing ;
xaxis  display= (nolabel) valueattrs=(family="verdana" size=8pt) fitpolicy=rotate ValuesRotate=Vertical;
yaxis  display= (nolabel) valueattrs=(family="verdana" size=8pt);
keylegend / location=outside position=bottomright across=2 title="" valueattrs=(size=10 family="verdana") outerpad=(top=0.2cm) noborder;
run; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 20 Mar 2021 14:51:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Keylegend-Elements-SGPLOT/m-p/727909#M21177</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2021-03-20T14:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: Keylegend Elements SGPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Keylegend-Elements-SGPLOT/m-p/727945#M21178</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/168930"&gt;@Anita_n&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Dear all,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a plot that looks like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Anita_n_0-1616251564544.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56188i49E353F59BB3C379/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Anita_n_0-1616251564544.png" alt="Anita_n_0-1616251564544.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I wish to insert the percentages in the graph and the keylegend should just be one or two lines outside the graph. I used across=2 but it isn't working. Any help?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data = mydata dattrmap= myattrmap pad=(bottom=5%) noautolegend noborder;
xaxis grid type=discrete discreteorder=data;
vbar year / response=frequencies group = mygroup attrid=mygroup barwidth=0.9 missing ;
xaxis  display= (nolabel) valueattrs=(family="verdana" size=8pt) fitpolicy=rotate ValuesRotate=Vertical;
yaxis  display= (nolabel) valueattrs=(family="verdana" size=8pt);
keylegend / location=outside position=bottomright across=2 title="" valueattrs=(size=10 family="verdana") outerpad=(top=0.2cm) noborder;
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The basic instruction to display a value on a VBAR is DATALABEL. If you have a variable that has the value you want then you use Datalabel=thatvariablename. If you do not supply a variable then it displays the value of the statistic summarized.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you actually have such small values, the blue and pinkish areas of your graph, you may not space on the graph to cleanly display the results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"Isn't working" is awful vague.&lt;BR /&gt;&lt;BR /&gt;Are there errors in the log?: Post the code and log in a code box opened with the "&amp;lt;/&amp;gt;" icon to maintain formatting of error messages.&lt;BR /&gt;&lt;BR /&gt;No output? Post any log in a code box.&lt;BR /&gt;&lt;BR /&gt;Unexpected output? Provide input data in the form of data step code pasted into a code box, the actual results and the expected results. Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the "&amp;lt;/&amp;gt;" icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 20 Mar 2021 21:23:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Keylegend-Elements-SGPLOT/m-p/727945#M21178</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-03-20T21:23:55Z</dc:date>
    </item>
    <item>
      <title>Re: Keylegend Elements SGPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Keylegend-Elements-SGPLOT/m-p/727985#M21180</link>
      <description>&lt;P&gt;Thank you for your reply, How can I remove the spaces on graph please inorder to&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;cleanly display the results?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;Here is my code and data&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sgplot data =test1 dattrmap=colors  pad=(bottom=5%) noautolegend noborder;
xaxis grid type=discrete discreteorder=data;
vbar year / response=rel_freq group=group_an  attrid=group_an barwidth=0.9 missing;
xaxis  display= (nolabel) valueattrs=(family="verdana" size=8pt) fitpolicy=rotate ValuesRotate=Vertical;
yaxis  display= (nolabel) valueattrs=(family="verdana" size=8pt);
keylegend / location=outside position=bottomright across=0 title="" 
valueattrs=(size=10 family="verdana") outerpad=(top=0.2cm) noborder;
run; &lt;/PRE&gt;
&lt;P&gt;I will also like to set the keylegend to just be a single row, to get more space for the graph. I used across=1 but it seems this is not working due to the length of the values. Am not sure anyway if am right. I will also like to display the no_cases and&amp;nbsp; percentages of each group in the corresponding bar.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will be grateful for any help&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;
&lt;P&gt;&amp;nbsp;&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>Sun, 21 Mar 2021 08:39:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Keylegend-Elements-SGPLOT/m-p/727985#M21180</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2021-03-21T08:39:29Z</dc:date>
    </item>
    <item>
      <title>Re: Keylegend Elements SGPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Keylegend-Elements-SGPLOT/m-p/728076#M21182</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;I will appreciate any suggestions to this topic&lt;/P&gt;</description>
      <pubDate>Mon, 22 Mar 2021 07:26:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Keylegend-Elements-SGPLOT/m-p/728076#M21182</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2021-03-22T07:26:18Z</dc:date>
    </item>
    <item>
      <title>Re: Keylegend Elements SGPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Keylegend-Elements-SGPLOT/m-p/728110#M21183</link>
      <description>&lt;P&gt;If I use the latest code you posted, and use keylegend / &lt;STRONG&gt;across=1&lt;/STRONG&gt; (rather than across=0), I get the legend in the bottom/right. Is this the legend you're wanting?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="keylegend.png" style="width: 640px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56216i2B687A038084D041/image-size/large?v=v2&amp;amp;px=999" role="button" title="keylegend.png" alt="keylegend.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Mar 2021 11:10:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Keylegend-Elements-SGPLOT/m-p/728110#M21183</guid>
      <dc:creator>GraphGuy</dc:creator>
      <dc:date>2021-03-22T11:10:28Z</dc:date>
    </item>
    <item>
      <title>Re: Keylegend Elements SGPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Keylegend-Elements-SGPLOT/m-p/728194#M21186</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13585"&gt;@GraphGuy&lt;/a&gt;&amp;nbsp;: Thanks for your reply. I taught I could get that the group names on one line but this seem not to be possible due to the length of the group names. I think I will have to shorten the names to get the desired result.&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp; mentioned that I could reduce the spaces on the graph to get neat results of the areas which have small values. I wish to know how to achieve this. I can only reduce the barwidth but what does he mean by reduce spaces on the graph to achieve neat results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also wish to show the values of the number of case in the bars. How can one do that in SAS?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Mar 2021 14:24:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Keylegend-Elements-SGPLOT/m-p/728194#M21186</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2021-03-22T14:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: Keylegend Elements SGPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Keylegend-Elements-SGPLOT/m-p/728203#M21188</link>
      <description>&lt;P&gt;Ahh! - so you want them in one row! (When you had mentioned across=2, I thought you were talking about columns.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could make your graph wider, or the legend text font smaller, or shorten the words/text of the legend.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Mar 2021 14:34:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Keylegend-Elements-SGPLOT/m-p/728203#M21188</guid>
      <dc:creator>GraphGuy</dc:creator>
      <dc:date>2021-03-22T14:34:56Z</dc:date>
    </item>
    <item>
      <title>Re: Keylegend Elements SGPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Keylegend-Elements-SGPLOT/m-p/728210#M21189</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13585"&gt;@GraphGuy&lt;/a&gt;&amp;nbsp;so how can I made my graph wider?&lt;/P&gt;</description>
      <pubDate>Mon, 22 Mar 2021 15:01:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Keylegend-Elements-SGPLOT/m-p/728210#M21189</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2021-03-22T15:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: Keylegend Elements SGPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Keylegend-Elements-SGPLOT/m-p/728238#M21192</link>
      <description>&lt;P&gt;Use the WIDTH and HEIGHT options on the ODS GRAPHICS statement to control the size. For example, add the following statement before you run the SG procedure:&lt;/P&gt;
&lt;P&gt;ods graphics / width=1000px height=480px;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Mar 2021 17:46:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Keylegend-Elements-SGPLOT/m-p/728238#M21192</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2021-03-22T17:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: Keylegend Elements SGPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Keylegend-Elements-SGPLOT/m-p/728266#M21194</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15130"&gt;@DanH_sas&lt;/a&gt;&amp;nbsp; ok, thanks I will try that&lt;/P&gt;</description>
      <pubDate>Mon, 22 Mar 2021 19:17:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Keylegend-Elements-SGPLOT/m-p/728266#M21194</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2021-03-22T19:17:29Z</dc:date>
    </item>
    <item>
      <title>Re: Keylegend Elements SGPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Keylegend-Elements-SGPLOT/m-p/728363#M21200</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15130"&gt;@DanH_sas&lt;/a&gt;&amp;nbsp;Hey, thanks it worked. I have also found out that the bars can be labelled using seglabel option. when I used that I got the following results:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Anita_n_0-1616485294367.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56294i74263C6AEFE823EB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Anita_n_0-1616485294367.png" alt="Anita_n_0-1616485294367.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Is there anyway to display the values of the small sized areas (using for example arrows) ? I mean is there any option which add arrows to display such values?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Mar 2021 07:53:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Keylegend-Elements-SGPLOT/m-p/728363#M21200</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2021-03-23T07:53:38Z</dc:date>
    </item>
    <item>
      <title>Re: Keylegend Elements SGPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Keylegend-Elements-SGPLOT/m-p/728617#M21208</link>
      <description>&lt;P&gt;You could use the sganno option for sgplot to annotate the small sections.&amp;nbsp; There are several papers that you can google for, check this out to begin with&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://support.sas.com/rnd/datavisualization/papers/Annotate_Your_SGPLOT_Graphs.pdf" target="_blank"&gt;https://support.sas.com/rnd/datavisualization/papers/Annotate_Your_SGPLOT_Graphs.pdf&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 02:11:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Keylegend-Elements-SGPLOT/m-p/728617#M21208</guid>
      <dc:creator>ghosh</dc:creator>
      <dc:date>2021-03-24T02:11:52Z</dc:date>
    </item>
    <item>
      <title>Re: Keylegend Elements SGPLOT</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Keylegend-Elements-SGPLOT/m-p/728718#M21211</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/78622"&gt;@ghosh&lt;/a&gt;&amp;nbsp;Thanks for that, I will try that right away&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 11:19:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Keylegend-Elements-SGPLOT/m-p/728718#M21211</guid>
      <dc:creator>Anita_n</dc:creator>
      <dc:date>2021-03-24T11:19:34Z</dc:date>
    </item>
  </channel>
</rss>

