<?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 Change the names in alegend in an SGPLOT in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Change-the-names-in-alegend-in-an-SGPLOT/m-p/475874#M30884</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to work out how to change the name in a SGPLOT legend. I'm using 1,2 and 3 to order the grouping in the bar chart&lt;/P&gt;&lt;P&gt;1 = ATT&lt;/P&gt;&lt;P&gt;2= AHold&amp;nbsp;&lt;/P&gt;&lt;P&gt;3= AWT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I now give the legend 'meaningful' names.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using SAS 9.4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code looks similar to this&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;PRE&gt;&lt;CODE class=" language-sas"&gt;Data test;
	Input date $ count average type;
	Datalines;

43252 2124 515 1  
43252 2124 162 2  
43252 2124 166 3  
43255 2984 491 1
43255 2984 156 2
43255 2984 171 3
43256 2713 518 1
43256 2713 153 2
43256 2713 161 3
43257 2540 509 1
43257 2540 156 2
43257 2540 157 3
;
RUN;

Proc SGPLOT data=test;
	HBAR date / Response=average Group=type datalabel seglabel;
	xaxis display=(noline noticks) grid values=(0 to 1200 by 150) offsetmin=0;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and my output looks like this&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="Capture10.JPG" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21596iE384DFC1665B34A4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture10.JPG" alt="Capture10.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;any help appreciated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dean&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 06 Jul 2018 00:41:27 GMT</pubDate>
    <dc:creator>DME790</dc:creator>
    <dc:date>2018-07-06T00:41:27Z</dc:date>
    <item>
      <title>Change the names in alegend in an SGPLOT</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Change-the-names-in-alegend-in-an-SGPLOT/m-p/475874#M30884</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to work out how to change the name in a SGPLOT legend. I'm using 1,2 and 3 to order the grouping in the bar chart&lt;/P&gt;&lt;P&gt;1 = ATT&lt;/P&gt;&lt;P&gt;2= AHold&amp;nbsp;&lt;/P&gt;&lt;P&gt;3= AWT&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I now give the legend 'meaningful' names.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using SAS 9.4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My code looks similar to this&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;PRE&gt;&lt;CODE class=" language-sas"&gt;Data test;
	Input date $ count average type;
	Datalines;

43252 2124 515 1  
43252 2124 162 2  
43252 2124 166 3  
43255 2984 491 1
43255 2984 156 2
43255 2984 171 3
43256 2713 518 1
43256 2713 153 2
43256 2713 161 3
43257 2540 509 1
43257 2540 156 2
43257 2540 157 3
;
RUN;

Proc SGPLOT data=test;
	HBAR date / Response=average Group=type datalabel seglabel;
	xaxis display=(noline noticks) grid values=(0 to 1200 by 150) offsetmin=0;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;and my output looks like this&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="Capture10.JPG" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/21596iE384DFC1665B34A4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture10.JPG" alt="Capture10.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;any help appreciated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dean&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jul 2018 00:41:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Change-the-names-in-alegend-in-an-SGPLOT/m-p/475874#M30884</guid>
      <dc:creator>DME790</dc:creator>
      <dc:date>2018-07-06T00:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: Change the names in alegend in an SGPLOT</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Change-the-names-in-alegend-in-an-SGPLOT/m-p/475899#M30885</link>
      <description>&lt;P&gt;Try using a format and&amp;nbsp;option grouporder as an extra precaution:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=test; by date type; run;

proc format;
value typeFmt
1 = "ATT"
2 = "AHold" 
3 = "AWT"
;

Proc SGPLOT data=test;
format type typeFmt.;
	HBAR date / Response=average Group=type grouporder=data datalabel seglabel;
	xaxis display=(noline noticks) grid values=(0 to 1200 by 150) offsetmin=0;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Jul 2018 04:22:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Change-the-names-in-alegend-in-an-SGPLOT/m-p/475899#M30885</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-07-06T04:22:13Z</dc:date>
    </item>
    <item>
      <title>Re: Change the names in alegend in an SGPLOT</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Change-the-names-in-alegend-in-an-SGPLOT/m-p/475900#M30886</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Works now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Dean&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Jul 2018 04:45:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Change-the-names-in-alegend-in-an-SGPLOT/m-p/475900#M30886</guid>
      <dc:creator>DME790</dc:creator>
      <dc:date>2018-07-06T04:45:18Z</dc:date>
    </item>
    <item>
      <title>Re: Change the names in alegend in an SGPLOT</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Change-the-names-in-alegend-in-an-SGPLOT/m-p/722807#M38265</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have the same problem, but in my case the "group" is not numeric type, &amp;nbsp;but character.&lt;/P&gt;&lt;P&gt;For example my group variable "age" is "young" and "old" and I want to have on the legend: "young age" "old age".&lt;/P&gt;&lt;P&gt;How can I do?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2021 08:32:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Change-the-names-in-alegend-in-an-SGPLOT/m-p/722807#M38265</guid>
      <dc:creator>marta25</dc:creator>
      <dc:date>2021-03-02T08:32:05Z</dc:date>
    </item>
    <item>
      <title>Re: Change the names in alegend in an SGPLOT</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Change-the-names-in-alegend-in-an-SGPLOT/m-p/722952#M38272</link>
      <description>&lt;P&gt;Use a user defined character format:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value $ageFmt
"old" = "old age"
"young" = "young age" 
;

Proc SGPLOT data=test;
format age $ageFmt.;
	HBAR date / Response=average Group=age grouporder=data datalabel seglabel;
	xaxis display=(noline noticks) grid values=(0 to 1200 by 150) offsetmin=0;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(untested)&lt;/P&gt;</description>
      <pubDate>Tue, 02 Mar 2021 19:26:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Change-the-names-in-alegend-in-an-SGPLOT/m-p/722952#M38272</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2021-03-02T19:26:18Z</dc:date>
    </item>
  </channel>
</rss>

