<?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 Changing legend location in AgreePlot in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Changing-legend-location-in-AgreePlot/m-p/361261#M18690</link>
    <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm a SAS EG&amp;nbsp;7.1 HF1 (7.100.0.2002) (64-bit) user.&lt;/P&gt;&lt;P&gt;I'm trying to change the legend location of an Agree Plot generated with PROC FREQ from its default location (bottomright) to topleft (to avoid overlapping with the plot lines). Here is the code that I've used to produce the plot:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods graphics on;
proc freq data=sashelp.baseball;
	table League*Division / agree nocol norow; 
	test kappa;
run;
ods graphics off;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Then I have used an &lt;STRONG&gt;ODS TRACE ON&lt;/STRONG&gt; statement to look for the proper template that I have to modify which is&amp;nbsp;&lt;STRONG&gt;Base.Freq.Graphics.AgreePlot&lt;/STRONG&gt;. I have obtained the full default template with:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc template;
	source Base.Freq.Graphics.AgreePlot;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The full template (where I have &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;highlighted in red&lt;/FONT&gt;&lt;/STRONG&gt; the places where I want something changed) is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;define statgraph Base.Freq.Graphics.AgreePlot;
   notes "Agreement Plot";
   dynamic _ROWVARNAME _ROWVARLABEL _SROWVARLABEL _COLVARNAME _COLVARLABEL _SCOLVARLABEL _XTICKS _YTICKS _XTICKLABELS _YTICKLABELS
      _PARTIAL _LEGEND _SCALE _ALIGN _STATS _BN _KAPPA _PWTK _WTKAPPA _N _byline_ _bytitle_ _byfootnote_;
   begingraph / includeMissingDiscrete=true;
      entrytitle "Agreement of " _ROWVARNAME " and " _COLVARNAME;
      layout overlay / aspectratio=1 yaxisopts=(offsetmax=0 offsetmin=0 label=_COLVARLABEL shortlabel=_SCOLVARLABEL linearopts=(
         tickvaluelist=_YTICKS tickdisplaylist=_YTICKLABELS)) y2axisopts=(offsetmax=0 offsetmin=0 label='Cumulative Frequency'
         display=_SCALE linearopts=(thresholdmin=0 thresholdmax=0)) xaxisopts=(offsetmax=0 offsetmin=0 label=_ROWVARLABEL
         shortlabel=_SROWVARLABEL linearopts=(tickvaluelist=_XTICKS tickdisplaylist=_XTICKLABELS tickvaluefitpolicy=staggerrotate));
         if (_PARTIAL)
            bandplot x=_X limitlower=_BL limitupper=_BU / type=step datatransparency=.7 name='b' legendlabel='Partial Agreement'
               rolename=(tip1=_PARTIALFREQ tip2=_PARTIALPERCENT) tiplabel=(tip1="Frequency" tip2="Percent") tip=(tip1 tip2);
            if (_LEGEND)
               discretelegend 'a' 'b' / across=1 autoalign=(&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;bottomright&lt;/STRONG&gt;&lt;/FONT&gt;) location=inside;
            endif;
         else
            if (_LEGEND)
               discretelegend 'a' / autoalign=(&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;bottomright&lt;/FONT&gt;&lt;/STRONG&gt;) location=inside;
            endif;
         endif;
         bandplot x=_X limitlower=_AL limitupper=_AU / type=step yaxis=y2 name='a' legendlabel='Exact Agreement' rolename=(tip1=
            _ROW tip2=_COLUMN tip3=_FREQ tip4=_PERCENT) tip=(tip1 tip2 tip3 tip4);
         seriesplot x=_X y=_YL / rolename=(tip1=_ROW tip2=_ROWFREQ tip3=_ROWPERCENT) tip=(tip1 tip2 tip3);
         seriesplot x=_X y=_YU / rolename=(tip1=_COLUMN tip2=_COLUMNFREQ tip3=_COLUMNPERCENT) tip=(tip1 tip2 tip3);
         drawline x1=0 y1=0 x2=100 y2=100 / x1space=datapercent y1space=datapercent x2space=datapercent y2space=datapercent
            transparency=.8 lineattrs=(thickness=1);
         if (_STATS)
            layout gridded / border=true columns=2 BackgroundColor=GraphWalls:Color Opaque=true shrinkfonts=true autoalign=_ALIGN;
               entry halign=left "B_N";
               entry halign=right eval (PUT(_BN, 6.4));
               entry halign=left "Kappa" / pad=(right=5);
               entry halign=right eval (PUT(_KAPPA, 6.4));
               if (_PWTK)
                  entry halign=left "Wt Kappa" / pad=(right=5);
                  entry halign=right eval (PUT(_WTKAPPA, 6.4));
               endif;
               entry halign=left "N";
               entry halign=right eval (PUT(_N, BEST7.));
            endlayout;
         endif;
      endlayout;
      if (_BYTITLE_)
         entrytitle _BYLINE_ / textattrs=GRAPHVALUETEXT;
      else
         if (_BYFOOTNOTE_)
            entryfootnote halign=left _BYLINE_;
         endif;
      endif;
   endgraph;
end;&lt;/PRE&gt;&lt;P&gt;I have tried to copy it to a &lt;STRONG&gt;PROC TEMPLATE&lt;/STRONG&gt; and change directly the "bottomright" by "topleft" before executing it, but it's not working. What is the easiest way to achieve what I'm trying? Is there a way to replace only the part that I'm interested on? Do you have to modify the default template editing it or can you create a new one with these new specifications and apply it to the &lt;STRONG&gt;PROC FREQ&lt;/STRONG&gt; afterwards?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for your help!! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 25 May 2017 12:34:04 GMT</pubDate>
    <dc:creator>emera86</dc:creator>
    <dc:date>2017-05-25T12:34:04Z</dc:date>
    <item>
      <title>Changing legend location in AgreePlot</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Changing-legend-location-in-AgreePlot/m-p/361261#M18690</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm a SAS EG&amp;nbsp;7.1 HF1 (7.100.0.2002) (64-bit) user.&lt;/P&gt;&lt;P&gt;I'm trying to change the legend location of an Agree Plot generated with PROC FREQ from its default location (bottomright) to topleft (to avoid overlapping with the plot lines). Here is the code that I've used to produce the plot:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods graphics on;
proc freq data=sashelp.baseball;
	table League*Division / agree nocol norow; 
	test kappa;
run;
ods graphics off;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Then I have used an &lt;STRONG&gt;ODS TRACE ON&lt;/STRONG&gt; statement to look for the proper template that I have to modify which is&amp;nbsp;&lt;STRONG&gt;Base.Freq.Graphics.AgreePlot&lt;/STRONG&gt;. I have obtained the full default template with:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc template;
	source Base.Freq.Graphics.AgreePlot;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The full template (where I have &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;highlighted in red&lt;/FONT&gt;&lt;/STRONG&gt; the places where I want something changed) is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;define statgraph Base.Freq.Graphics.AgreePlot;
   notes "Agreement Plot";
   dynamic _ROWVARNAME _ROWVARLABEL _SROWVARLABEL _COLVARNAME _COLVARLABEL _SCOLVARLABEL _XTICKS _YTICKS _XTICKLABELS _YTICKLABELS
      _PARTIAL _LEGEND _SCALE _ALIGN _STATS _BN _KAPPA _PWTK _WTKAPPA _N _byline_ _bytitle_ _byfootnote_;
   begingraph / includeMissingDiscrete=true;
      entrytitle "Agreement of " _ROWVARNAME " and " _COLVARNAME;
      layout overlay / aspectratio=1 yaxisopts=(offsetmax=0 offsetmin=0 label=_COLVARLABEL shortlabel=_SCOLVARLABEL linearopts=(
         tickvaluelist=_YTICKS tickdisplaylist=_YTICKLABELS)) y2axisopts=(offsetmax=0 offsetmin=0 label='Cumulative Frequency'
         display=_SCALE linearopts=(thresholdmin=0 thresholdmax=0)) xaxisopts=(offsetmax=0 offsetmin=0 label=_ROWVARLABEL
         shortlabel=_SROWVARLABEL linearopts=(tickvaluelist=_XTICKS tickdisplaylist=_XTICKLABELS tickvaluefitpolicy=staggerrotate));
         if (_PARTIAL)
            bandplot x=_X limitlower=_BL limitupper=_BU / type=step datatransparency=.7 name='b' legendlabel='Partial Agreement'
               rolename=(tip1=_PARTIALFREQ tip2=_PARTIALPERCENT) tiplabel=(tip1="Frequency" tip2="Percent") tip=(tip1 tip2);
            if (_LEGEND)
               discretelegend 'a' 'b' / across=1 autoalign=(&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;bottomright&lt;/STRONG&gt;&lt;/FONT&gt;) location=inside;
            endif;
         else
            if (_LEGEND)
               discretelegend 'a' / autoalign=(&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;bottomright&lt;/FONT&gt;&lt;/STRONG&gt;) location=inside;
            endif;
         endif;
         bandplot x=_X limitlower=_AL limitupper=_AU / type=step yaxis=y2 name='a' legendlabel='Exact Agreement' rolename=(tip1=
            _ROW tip2=_COLUMN tip3=_FREQ tip4=_PERCENT) tip=(tip1 tip2 tip3 tip4);
         seriesplot x=_X y=_YL / rolename=(tip1=_ROW tip2=_ROWFREQ tip3=_ROWPERCENT) tip=(tip1 tip2 tip3);
         seriesplot x=_X y=_YU / rolename=(tip1=_COLUMN tip2=_COLUMNFREQ tip3=_COLUMNPERCENT) tip=(tip1 tip2 tip3);
         drawline x1=0 y1=0 x2=100 y2=100 / x1space=datapercent y1space=datapercent x2space=datapercent y2space=datapercent
            transparency=.8 lineattrs=(thickness=1);
         if (_STATS)
            layout gridded / border=true columns=2 BackgroundColor=GraphWalls:Color Opaque=true shrinkfonts=true autoalign=_ALIGN;
               entry halign=left "B_N";
               entry halign=right eval (PUT(_BN, 6.4));
               entry halign=left "Kappa" / pad=(right=5);
               entry halign=right eval (PUT(_KAPPA, 6.4));
               if (_PWTK)
                  entry halign=left "Wt Kappa" / pad=(right=5);
                  entry halign=right eval (PUT(_WTKAPPA, 6.4));
               endif;
               entry halign=left "N";
               entry halign=right eval (PUT(_N, BEST7.));
            endlayout;
         endif;
      endlayout;
      if (_BYTITLE_)
         entrytitle _BYLINE_ / textattrs=GRAPHVALUETEXT;
      else
         if (_BYFOOTNOTE_)
            entryfootnote halign=left _BYLINE_;
         endif;
      endif;
   endgraph;
end;&lt;/PRE&gt;&lt;P&gt;I have tried to copy it to a &lt;STRONG&gt;PROC TEMPLATE&lt;/STRONG&gt; and change directly the "bottomright" by "topleft" before executing it, but it's not working. What is the easiest way to achieve what I'm trying? Is there a way to replace only the part that I'm interested on? Do you have to modify the default template editing it or can you create a new one with these new specifications and apply it to the &lt;STRONG&gt;PROC FREQ&lt;/STRONG&gt; afterwards?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for your help!! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2017 12:34:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Changing-legend-location-in-AgreePlot/m-p/361261#M18690</guid>
      <dc:creator>emera86</dc:creator>
      <dc:date>2017-05-25T12:34:04Z</dc:date>
    </item>
    <item>
      <title>Re: Changing legend location in AgreePlot</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Changing-legend-location-in-AgreePlot/m-p/361552#M18693</link>
      <description>&lt;P&gt;&lt;STRONG&gt;UPDATE:&lt;/STRONG&gt; It was just a silly error that was preventing my code from running properly and now it's working fine. Now I'm wondering if there is a simpler way for just changing the value of a single template parameter than "PROC TEMPLATE" the full template with the wanted changes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again for your help!! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 May 2017 12:39:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Changing-legend-location-in-AgreePlot/m-p/361552#M18693</guid>
      <dc:creator>emera86</dc:creator>
      <dc:date>2017-05-25T12:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: Changing legend location in AgreePlot</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Changing-legend-location-in-AgreePlot/m-p/363121#M18735</link>
      <description>&lt;P&gt;I have finally found a place where I have found the solution to all my doubts:&lt;/P&gt;&lt;P&gt;&lt;A href="https://support.sas.com/documentation/cdl/en/statug/63962/HTML/default/viewer.htm#statug_templt_sect005.htm" target="_blank"&gt;https://support.sas.com/documentation/cdl/en/statug/63962/HTML/default/viewer.htm#statug_templt_sect005.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 15:22:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Changing-legend-location-in-AgreePlot/m-p/363121#M18735</guid>
      <dc:creator>emera86</dc:creator>
      <dc:date>2017-05-31T15:22:10Z</dc:date>
    </item>
  </channel>
</rss>

