<?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 do I change legend value labels in PROC SGPANEL in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/How-do-I-change-legend-value-labels-in-PROC-SGPANEL/m-p/496772#M16975</link>
    <description>&lt;P&gt;Thank you so much! Your coding&amp;nbsp;of 'Group variable with format' worked:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Proc format library=work;&lt;BR /&gt;value $redcap_event_name&lt;BR /&gt;'baseline_arm_1' = 'Baseline'&lt;BR /&gt;'midintervention_6_arm_1' = 'Midintervention';&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;PROC SGPANEL DATA=base_mid;&lt;BR /&gt;PANELBY exp_con;&lt;BR /&gt;vbar chew1 / GROUP = redcap_event_name groupdisplay=cluster;&lt;BR /&gt;format redcap_event_name $redcap_event_name.;&lt;BR /&gt;keylegend / title='Assessment';&lt;BR /&gt;TITLE 'Health Literacy Q1J';&lt;BR /&gt;RUN;&lt;/P&gt;</description>
    <pubDate>Tue, 18 Sep 2018 22:19:47 GMT</pubDate>
    <dc:creator>White2AA</dc:creator>
    <dc:date>2018-09-18T22:19:47Z</dc:date>
    <item>
      <title>How do I change legend value labels in PROC SGPANEL</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-do-I-change-legend-value-labels-in-PROC-SGPANEL/m-p/496699#M16973</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using survey data and trying to change the legend value labels highlighted in the picture below to just 'baseline' and 'midintervention'. This is tricky because they are values of the variable name: redcap_event_name and not variables themselves. I did not code these values as shown in the legend so I am not sure why they are appearing in this format. I have tried multiple codes (examples below) but continue to receive error messages and no changes in the legend. Any insight?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Legend Labels.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/23358i8411E04153631270/image-size/large?v=v2&amp;amp;px=999" role="button" title="Legend Labels.JPG" alt="Legend Labels.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SGPANEL DATA=base_mid;&lt;BR /&gt;PANELBY exp_con;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;vbar chew1 / GROUP = redcap_event_name groupdisplay=cluster;&lt;BR /&gt;keylegend / title='Assessment' valueattrs=(baseline_arm_1= 'baseline' midintervention_6_arm_1='midintervention');&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;TITLE 'Health Literacy Q1J';&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PROC SGPANEL DATA=base_mid;&lt;BR /&gt;PANELBY exp_con;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;vbar chew1 / GROUP = redcap_event_name groupdisplay=cluster legendlabel = 'baseline';&amp;nbsp;&lt;BR /&gt;keylegend / title='Assessment';&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;TITLE 'Health Literacy Q1J';&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: Copyright (c) 2016 by SAS Institute Inc., Cary, NC, USA.&lt;BR /&gt;NOTE: SAS (r) Proprietary Software 9.4 (TS1M5)&lt;BR /&gt;Licensed to MEDICAL UNIVERSITY OF SOUTH CAROLINA, Site 70085904.&lt;BR /&gt;NOTE: This session is executing on the X64_8HOME platform.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: Updated analytical products:&lt;/P&gt;&lt;P&gt;SAS/STAT 14.3&lt;BR /&gt;SAS/ETS 14.3&lt;BR /&gt;SAS/OR 14.3&lt;BR /&gt;SAS/IML 14.3&lt;BR /&gt;SAS/QC 14.3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 19:03:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-do-I-change-legend-value-labels-in-PROC-SGPANEL/m-p/496699#M16973</guid>
      <dc:creator>White2AA</dc:creator>
      <dc:date>2018-09-18T19:03:40Z</dc:date>
    </item>
    <item>
      <title>Re: How do I change legend value labels in PROC SGPANEL</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-do-I-change-legend-value-labels-in-PROC-SGPANEL/m-p/496717#M16974</link>
      <description>&lt;P&gt;Legend values are the values of the group variable. If the variable is character then the default format is a simple $ format and displays the text. If you want something else to appear then you either assign a custom format to the variable (doesn't require change in the data) or add a different variable with the text you want to apply (requires an additional data step).&lt;/P&gt;
&lt;P&gt;Example with a data set you should have available.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sgpanel data=sashelp.cars(where=(origin in ('Europe' 'USA')));
   title 'Group variable without format';
   panelby origin ;
   vbar type/ group=drivetrain groupdisplay=cluster;
run;

proc format library=work;
value $drivetrain
'All' = 'AWD'
'Front' = 'FWD'
'Rear'  = 'RWD'
;
run ;

proc sgpanel data=sashelp.cars(where=(origin in ('Europe' 'USA')));
   title 'Group variable with format';
   panelby origin ;
   vbar type/ group=drivetrain groupdisplay=cluster;
   format drivetrain $drivetrain.;
run;title;

&lt;/PRE&gt;
&lt;P&gt;Formats are very powerful in SAS in that you can create groups just by changing the format:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc format library=work;
value $dt
'All' = 'AWD'
'Front' ,'Rear'  = '2WD'
;
run ;
proc sgpanel data=sashelp.cars(where=(origin in ('Europe' 'USA')));
   title 'Group variable with different format';
   panelby origin ;
   vbar type/ group=drivetrain groupdisplay=cluster;
   format drivetrain $dt.;
run;title;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Sep 2018 15:41:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-do-I-change-legend-value-labels-in-PROC-SGPANEL/m-p/496717#M16974</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-09-19T15:41:25Z</dc:date>
    </item>
    <item>
      <title>Re: How do I change legend value labels in PROC SGPANEL</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/How-do-I-change-legend-value-labels-in-PROC-SGPANEL/m-p/496772#M16975</link>
      <description>&lt;P&gt;Thank you so much! Your coding&amp;nbsp;of 'Group variable with format' worked:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Proc format library=work;&lt;BR /&gt;value $redcap_event_name&lt;BR /&gt;'baseline_arm_1' = 'Baseline'&lt;BR /&gt;'midintervention_6_arm_1' = 'Midintervention';&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;PROC SGPANEL DATA=base_mid;&lt;BR /&gt;PANELBY exp_con;&lt;BR /&gt;vbar chew1 / GROUP = redcap_event_name groupdisplay=cluster;&lt;BR /&gt;format redcap_event_name $redcap_event_name.;&lt;BR /&gt;keylegend / title='Assessment';&lt;BR /&gt;TITLE 'Health Literacy Q1J';&lt;BR /&gt;RUN;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2018 22:19:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/How-do-I-change-legend-value-labels-in-PROC-SGPANEL/m-p/496772#M16975</guid>
      <dc:creator>White2AA</dc:creator>
      <dc:date>2018-09-18T22:19:47Z</dc:date>
    </item>
  </channel>
</rss>

