<?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: PROC GPLOT --ANNOTATE LABEL in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/PROC-GPLOT-ANNOTATE-LABEL/m-p/603822#M19108</link>
    <description>&lt;P&gt;Can you use the annotate in PROC GPLOT?&lt;/P&gt;&lt;P&gt;&amp;nbsp;Thank you.&lt;/P&gt;</description>
    <pubDate>Wed, 13 Nov 2019 12:04:12 GMT</pubDate>
    <dc:creator>Emma8</dc:creator>
    <dc:date>2019-11-13T12:04:12Z</dc:date>
    <item>
      <title>PROC GPLOT --ANNOTATE LABEL</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-GPLOT-ANNOTATE-LABEL/m-p/603676#M19102</link>
      <description>&lt;P&gt;Hi. Can anyone help with the below problem?&lt;/P&gt;&lt;P&gt;I would like to label each line as Q1, median, and Q3 at the end of the lines. The below code does not show the text label.&lt;/P&gt;&lt;P&gt;I attached the data.&lt;/P&gt;&lt;P&gt;Thank you.&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;/* Create the Annotate data set LINETEXT */&lt;BR /&gt;data linetext (drop=var26: time );&lt;BR /&gt;length function text $ 20 style $ 25;&lt;BR /&gt;retain function 'label' xsys ysys '2' position '2' color 'black' size 1.5;&lt;BR /&gt;set DATA end=last;&lt;BR /&gt;style = "'Albany AMT/bold'";&lt;BR /&gt;if last then do;&lt;BR /&gt;x=Time;&lt;BR /&gt;y= left(put(var26r_Q1,percent12.0)); text='Q1'; output;&lt;BR /&gt;y= left(put(var26r_Median,percent12.0)); text='Median'; output;&lt;BR /&gt;y= left(put(var26r_Q3,percent12.0)); text='Q2'; output;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc gplot data=DATA;&lt;BR /&gt;plot (var26r_Q1 var26r_Median var26r_Q3 )*Time / overlay frame&lt;BR /&gt;haxis=axis1 vaxis=axis2&lt;BR /&gt;annotate=linetext ;&lt;BR /&gt;axis1 minor=none offset=(1,8)pct label=('Year and Quarter');&lt;BR /&gt;axis2 order=(0 to 1 by 0.2) offset=(2,1)pct&lt;BR /&gt;label=('CRC' justify=right '(in percentage)');&lt;BR /&gt;/* Choose the interpolation method and assign symbol characteristics */&lt;BR /&gt;symbol1 interpol=line width=2 color='#99d8c9';&lt;BR /&gt;symbol2 interpol=line width=2 color='#2ca25f';&lt;BR /&gt;symbol3 interpol=line width=2 color='#99d8c9';&lt;BR /&gt;format var26r_Q1 var26r_Median var26r_Q3 percent12.0;&lt;BR /&gt;run;&lt;BR /&gt;quit;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2019 18:59:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-GPLOT-ANNOTATE-LABEL/m-p/603676#M19102</guid>
      <dc:creator>Emma8</dc:creator>
      <dc:date>2019-11-12T18:59:43Z</dc:date>
    </item>
    <item>
      <title>Re: PROC GPLOT --ANNOTATE LABEL</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-GPLOT-ANNOTATE-LABEL/m-p/603699#M19103</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/294547"&gt;@Emma8&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi. Can anyone help with the below problem?&lt;/P&gt;
&lt;P&gt;I would like to label each line as Q1, median, and Q3 at the end of the lines. The below code does not show the text label.&lt;/P&gt;
&lt;P&gt;I attached the data.&lt;/P&gt;
&lt;P&gt;Thank you.&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;/* Create the Annotate data set LINETEXT */&lt;BR /&gt;data linetext (drop=var26: time );&lt;BR /&gt;length function text $ 20 style $ 25;&lt;BR /&gt;retain function 'label' xsys ysys '2' position '2' color 'black' size 1.5;&lt;BR /&gt;set DATA end=last;&lt;BR /&gt;style = "'Albany AMT/bold'";&lt;BR /&gt;if last then do;&lt;BR /&gt;x=Time;&lt;BR /&gt;y= left(put(var26r_Q1,percent12.0)); text='Q1'; output;&lt;BR /&gt;y= left(put(var26r_Median,percent12.0)); text='Median'; output;&lt;BR /&gt;y= left(put(var26r_Q3,percent12.0)); text='Q2'; output;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc gplot data=DATA;&lt;BR /&gt;plot (var26r_Q1 var26r_Median var26r_Q3 )*Time / overlay frame&lt;BR /&gt;haxis=axis1 vaxis=axis2&lt;BR /&gt;annotate=linetext ;&lt;BR /&gt;axis1 minor=none offset=(1,8)pct label=('Year and Quarter');&lt;BR /&gt;axis2 order=(0 to 1 by 0.2) offset=(2,1)pct&lt;BR /&gt;label=('CRC' justify=right '(in percentage)');&lt;BR /&gt;/* Choose the interpolation method and assign symbol characteristics */&lt;BR /&gt;symbol1 interpol=line width=2 color='#99d8c9';&lt;BR /&gt;symbol2 interpol=line width=2 color='#2ca25f';&lt;BR /&gt;symbol3 interpol=line width=2 color='#99d8c9';&lt;BR /&gt;format var26r_Q1 var26r_Median var26r_Q3 percent12.0;&lt;BR /&gt;run;&lt;BR /&gt;quit;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;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 {i} 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;
&lt;P&gt;Please post data as a data step. Your xls file did not have numeric values for the x axis so plots don't want to work correctly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You really should consider using the newer plots SGPLOT as there are many more options available and the output will generally work better with the ODS files created:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Consider:&lt;/P&gt;
&lt;PRE&gt;proc sgplot data=data;
   series x=time y= var26r_Q1     / lineattrs=( color='#99d8c9') curvelabel='Q1';
   series x=time y= var26r_Median / lineattrs=( color='#2ca25f') curvelabel='Median';
   series x=time y= var26r_Q3     / lineattrs=( color='#99d8c9') curvelabel='Q3';
run;
&lt;/PRE&gt;
&lt;P&gt;options involved with the INTERPOL symbol options are mostly involved with LINEATTRS for line width, color and type.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2019 20:13:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-GPLOT-ANNOTATE-LABEL/m-p/603699#M19103</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-11-12T20:13:26Z</dc:date>
    </item>
    <item>
      <title>Re: PROC GPLOT --ANNOTATE LABEL</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-GPLOT-ANNOTATE-LABEL/m-p/603702#M19104</link>
      <description>&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;Sorry, it should be formatted by percent12.0.&lt;/P&gt;&lt;P&gt;See attached.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2019 20:18:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-GPLOT-ANNOTATE-LABEL/m-p/603702#M19104</guid>
      <dc:creator>Emma8</dc:creator>
      <dc:date>2019-11-12T20:18:57Z</dc:date>
    </item>
    <item>
      <title>Re: PROC GPLOT --ANNOTATE LABEL</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-GPLOT-ANNOTATE-LABEL/m-p/603729#M19105</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/294547"&gt;@Emma8&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;P&gt;Sorry, it should be formatted by percent12.0.&lt;/P&gt;
&lt;P&gt;See attached.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then add the format statement.&lt;/P&gt;
&lt;P&gt;A&lt;/P&gt;</description>
      <pubDate>Tue, 12 Nov 2019 23:30:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-GPLOT-ANNOTATE-LABEL/m-p/603729#M19105</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-11-12T23:30:07Z</dc:date>
    </item>
    <item>
      <title>Re: PROC GPLOT --ANNOTATE LABEL</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-GPLOT-ANNOTATE-LABEL/m-p/603822#M19108</link>
      <description>&lt;P&gt;Can you use the annotate in PROC GPLOT?&lt;/P&gt;&lt;P&gt;&amp;nbsp;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2019 12:04:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-GPLOT-ANNOTATE-LABEL/m-p/603822#M19108</guid>
      <dc:creator>Emma8</dc:creator>
      <dc:date>2019-11-13T12:04:12Z</dc:date>
    </item>
    <item>
      <title>Re: PROC GPLOT --ANNOTATE LABEL</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-GPLOT-ANNOTATE-LABEL/m-p/603892#M19111</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/294547"&gt;@Emma8&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Can you use the annotate in PROC GPLOT?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Thank you.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I can and basically choose not to any more as the basic graph functionality is limited and showing multiple types of plots together is usually difficult plus often impossible.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Currently to have access to Proc Gplot you need an additional license to SAS/Graph while the statistical graphics procedures Sgplot, Sgpanel and such are part of BASE SAS. Also Proc SGPLOT supports all the plot types of GPLOT, GChart and several more.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One is a TEXTPLOT where you can have X, Y coordinates and a variable holding text. So if you have some records at the end of data set you can add text at any coordinates without having to go through the annotate facility.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Without an actual SAS data set to attempt to graph I wouldn't even try. XLS is not a data set. I have to make choices to create a data set and my choices likely do not match yours and may not be able to plot it at all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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 {i} icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Nov 2019 15:44:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-GPLOT-ANNOTATE-LABEL/m-p/603892#M19111</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-11-13T15:44:59Z</dc:date>
    </item>
    <item>
      <title>Re: PROC GPLOT --ANNOTATE LABEL</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/PROC-GPLOT-ANNOTATE-LABEL/m-p/605019#M19115</link>
      <description>&lt;P&gt;Hi Emma,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You had everything very close to being what you needed!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Since the x value in the plot ('year_qtr') are character, you'll need to use xc, rather than x, in your annotate dataset.&lt;/P&gt;
&lt;P&gt;And since your y values in the plot are numeric, you'll need to use their raw/numeric values as y in your annotate dataset (rather than applying the format, and saving them as character).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've made those changes, and added a few little "finishing touches", and included the graph below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc import out=my_data datafile='data.xls' dbms=xls;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data anno_text (drop=var26: time); set my_data end=last;&lt;BR /&gt;length text $50;&lt;BR /&gt;xsys='2'; ysys='2'; hsys='3'; when='a';&lt;BR /&gt;function='label'; style='Albany AMT/bold';&lt;BR /&gt;color='gray33'; position='&amp;gt;'; size=2.0;&lt;BR /&gt;if last then do;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;xc=Time;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;y=var26r_Q1; text='a0'x||'Q1'; output;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;y=var26r_Median; text='a0'x||'Median'; output;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;y=var26r_Q3; text='a0'x||'Q2'; output;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;end;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;goptions gunit=pct htitle=5 htext=3.0 ftitle="albany amt/bold" ftext="albany amt";&lt;BR /&gt;goptions ctext=gray33;&lt;/P&gt;
&lt;P&gt;axis1 minor=none offset=(1,8)pct label=('Year and Quarter')&lt;BR /&gt;value=(angle=90) label=none;&lt;/P&gt;
&lt;P&gt;axis2 order=(0 to 1 by 0.2) offset=(0,0) minor=none&lt;BR /&gt;label=('CRC' justify=right '(in percentage)');&lt;/P&gt;
&lt;P&gt;symbol1 interpol=line width=2 color='#99d8c9';&lt;BR /&gt;symbol2 interpol=line width=2 color='#2ca25f';&lt;BR /&gt;symbol3 interpol=line width=2 color='#99d8c9';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc gplot data=my_data;&lt;BR /&gt;format var26r_Q1 var26r_Median var26r_Q3 percent12.0;&lt;BR /&gt;plot (var26r_Q1 var26r_Median var26r_Q3 )*Time / overlay frame&lt;BR /&gt;haxis=axis1 vaxis=axis2&lt;BR /&gt;annotate=anno_text;&lt;BR /&gt;run;&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="emmaplot.png" style="width: 912px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/34057iA0E06811CA9BE1ED/image-dimensions/912x684?v=v2" width="912" height="684" role="button" title="emmaplot.png" alt="emmaplot.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2019 14:42:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/PROC-GPLOT-ANNOTATE-LABEL/m-p/605019#M19115</guid>
      <dc:creator>GraphGuy</dc:creator>
      <dc:date>2019-11-18T14:42:02Z</dc:date>
    </item>
  </channel>
</rss>

