<?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 SG annotation help in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/SG-annotation-help/m-p/583460#M18754</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am a novice in SAS graphics, as I don't get a lpt of practice on it.&lt;/P&gt;&lt;P&gt;I am trying to annotate as per the following Figure in my Figure. but somehow not able to get there. Can you please help? I will share my annotation as well, I am sure it's no good,but this is as good as I am at the moment. I have the ref lines and every other thing required here. except the annotations. Please help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The expected Figure:&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/31976iC2612BFC3C281EC3/image-size/large?v=1.0&amp;amp;px=-1" border="0" width="600" height="263" title="Capture1.PNG" alt="Capture1.PNG" /&gt;&lt;/P&gt;&lt;P&gt;My SAS code for Annotation:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*data Anno_N;
    length function $10 x1space $12 label TEXTFONT $500;
    set datafile2 end=last;
    *retain id 0 function x1space y1space textcolor textsize TEXTFONT
    textweight anchor width widthunit y1;
	TEXTFONT="Albany AMT";
	if newcol=mdiffm1m2 then do;
    textcolor="black"; function='text'; y1=mdiffm1m2; x1space="Wallpercent"; y1space="datavalue";
	label="Mean"; widthunit='percent'; textsize=10; textweight='normal'; anchor='right'; 
    end; 
	if newcol=lldiffm1m22 then do;
    textcolor="black"; function='text'; y2=lldiffm1m22; x2space="Wallpercent"; y2space="datavalue";
	label="Mean3"; widthunit='percent'; textsize=10; textweight='normal'; anchor='right';width=30; 
    end; 
run;*/

options nonumber nodate;
ods graphics / reset width=1200px height=700px imagename='Full' ;
ods listing close; 
ods escapechar='~';
ODS rtf FILE = "&amp;amp;outpath.&amp;amp;output..rtf";
symbol value=dot interpol=join repeat=100;
ods graphics / reset width=1200px height=700px imagename='Full';

title1 j=c  "Bland-Altman Plot for Day 1 and Day 2 observed values at Screening, 6 Min WT Dist.";
title2 j=c "Efficacy Set";
footnote1 " ";

proc sgplot data=datafile2(where=(_visit_="Screening")) /*sganno=anno_n*/;
scatter x=meanm1m2 y=diffm1m2/ markerattrs=(color=green) tip=(meanm1m2 diffm1m2);
refline lldiffm1m22 / axis=y lineattrs=(color=red pattern=4 thickness=2pt);
refline mdiffm1m2/ axis=y lineattrs=(color=blue thickness=2pt);
refline uldiffm1m22/ axis=y lineattrs=(color=red pattern=4 thickness=2pt);
yaxis label='Day 1 - Day 2' labelattrs=(style=normal );
xaxis label='Mean of Day 1 and Day 2';
run;

ods rtf close; 
ods listing;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The SG plot seems to be okay. I will uncomment sganno if my annotation works.&amp;nbsp; but this doesn't.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know, if ant other info is needed. Thanks&lt;/P&gt;</description>
    <pubDate>Fri, 23 Aug 2019 13:02:24 GMT</pubDate>
    <dc:creator>VinnyR</dc:creator>
    <dc:date>2019-08-23T13:02:24Z</dc:date>
    <item>
      <title>SG annotation help</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SG-annotation-help/m-p/583460#M18754</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am a novice in SAS graphics, as I don't get a lpt of practice on it.&lt;/P&gt;&lt;P&gt;I am trying to annotate as per the following Figure in my Figure. but somehow not able to get there. Can you please help? I will share my annotation as well, I am sure it's no good,but this is as good as I am at the moment. I have the ref lines and every other thing required here. except the annotations. Please help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The expected Figure:&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/31976iC2612BFC3C281EC3/image-size/large?v=1.0&amp;amp;px=-1" border="0" width="600" height="263" title="Capture1.PNG" alt="Capture1.PNG" /&gt;&lt;/P&gt;&lt;P&gt;My SAS code for Annotation:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*data Anno_N;
    length function $10 x1space $12 label TEXTFONT $500;
    set datafile2 end=last;
    *retain id 0 function x1space y1space textcolor textsize TEXTFONT
    textweight anchor width widthunit y1;
	TEXTFONT="Albany AMT";
	if newcol=mdiffm1m2 then do;
    textcolor="black"; function='text'; y1=mdiffm1m2; x1space="Wallpercent"; y1space="datavalue";
	label="Mean"; widthunit='percent'; textsize=10; textweight='normal'; anchor='right'; 
    end; 
	if newcol=lldiffm1m22 then do;
    textcolor="black"; function='text'; y2=lldiffm1m22; x2space="Wallpercent"; y2space="datavalue";
	label="Mean3"; widthunit='percent'; textsize=10; textweight='normal'; anchor='right';width=30; 
    end; 
run;*/

options nonumber nodate;
ods graphics / reset width=1200px height=700px imagename='Full' ;
ods listing close; 
ods escapechar='~';
ODS rtf FILE = "&amp;amp;outpath.&amp;amp;output..rtf";
symbol value=dot interpol=join repeat=100;
ods graphics / reset width=1200px height=700px imagename='Full';

title1 j=c  "Bland-Altman Plot for Day 1 and Day 2 observed values at Screening, 6 Min WT Dist.";
title2 j=c "Efficacy Set";
footnote1 " ";

proc sgplot data=datafile2(where=(_visit_="Screening")) /*sganno=anno_n*/;
scatter x=meanm1m2 y=diffm1m2/ markerattrs=(color=green) tip=(meanm1m2 diffm1m2);
refline lldiffm1m22 / axis=y lineattrs=(color=red pattern=4 thickness=2pt);
refline mdiffm1m2/ axis=y lineattrs=(color=blue thickness=2pt);
refline uldiffm1m22/ axis=y lineattrs=(color=red pattern=4 thickness=2pt);
yaxis label='Day 1 - Day 2' labelattrs=(style=normal );
xaxis label='Mean of Day 1 and Day 2';
run;

ods rtf close; 
ods listing;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The SG plot seems to be okay. I will uncomment sganno if my annotation works.&amp;nbsp; but this doesn't.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know, if ant other info is needed. Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 13:02:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SG-annotation-help/m-p/583460#M18754</guid>
      <dc:creator>VinnyR</dc:creator>
      <dc:date>2019-08-23T13:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: SG annotation help</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SG-annotation-help/m-p/583503#M18755</link>
      <description>&lt;P&gt;Consider skipping it as an annotation and use a TEXT statement instead.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For text, create three new variables, your text, x and y locations.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then use a TEXT statement within the SGPLOT procedure.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?docsetId=grstatproc&amp;amp;docsetTarget=n0lprj1bdrlrkgn1vmqnd7r6fnry.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en"&gt;https://documentation.sas.com/?docsetId=grstatproc&amp;amp;docsetTarget=n0lprj1bdrlrkgn1vmqnd7r6fnry.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data datafile3;
set datafile2 anno_n;

run;


[rest of sas code]

proc sgplot data=datafile3(where=(_visit_ = "Screening"));

[rest of SAS code]


text text = label x= Xvariable y = YVariable ;

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/158682"&gt;@VinnyR&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am a novice in SAS graphics, as I don't get a lpt of practice on it.&lt;/P&gt;
&lt;P&gt;I am trying to annotate as per the following Figure in my Figure. but somehow not able to get there. Can you please help? I will share my annotation as well, I am sure it's no good,but this is as good as I am at the moment. I have the ref lines and every other thing required here. except the annotations. Please help.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The expected Figure:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture1.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31976iC2612BFC3C281EC3/image-dimensions/600x263?v=v2" width="600" height="263" role="button" title="Capture1.PNG" alt="Capture1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;My SAS code for Annotation:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*data Anno_N;
    length function $10 x1space $12 label TEXTFONT $500;
    set datafile2 end=last;
    *retain id 0 function x1space y1space textcolor textsize TEXTFONT
    textweight anchor width widthunit y1;
	TEXTFONT="Albany AMT";
	if newcol=mdiffm1m2 then do;
    textcolor="black"; function='text'; y1=mdiffm1m2; x1space="Wallpercent"; y1space="datavalue";
	label="Mean"; widthunit='percent'; textsize=10; textweight='normal'; anchor='right'; 
    end; 
	if newcol=lldiffm1m22 then do;
    textcolor="black"; function='text'; y2=lldiffm1m22; x2space="Wallpercent"; y2space="datavalue";
	label="Mean3"; widthunit='percent'; textsize=10; textweight='normal'; anchor='right';width=30; 
    end; 
run;*/

options nonumber nodate;
ods graphics / reset width=1200px height=700px imagename='Full' ;
ods listing close; 
ods escapechar='~';
ODS rtf FILE = "&amp;amp;outpath.&amp;amp;output..rtf";
symbol value=dot interpol=join repeat=100;
ods graphics / reset width=1200px height=700px imagename='Full';

title1 j=c  "Bland-Altman Plot for Day 1 and Day 2 observed values at Screening, 6 Min WT Dist.";
title2 j=c "Efficacy Set";
footnote1 " ";

proc sgplot data=datafile2(where=(_visit_="Screening")) /*sganno=anno_n*/;
scatter x=meanm1m2 y=diffm1m2/ markerattrs=(color=green) tip=(meanm1m2 diffm1m2);
refline lldiffm1m22 / axis=y lineattrs=(color=red pattern=4 thickness=2pt);
refline mdiffm1m2/ axis=y lineattrs=(color=blue thickness=2pt);
refline uldiffm1m22/ axis=y lineattrs=(color=red pattern=4 thickness=2pt);
yaxis label='Day 1 - Day 2' labelattrs=(style=normal );
xaxis label='Mean of Day 1 and Day 2';
run;

ods rtf close; 
ods listing;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The SG plot seems to be okay. I will uncomment sganno if my annotation works.&amp;nbsp; but this doesn't.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me know, if ant other info is needed. Thanks&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 15:09:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SG-annotation-help/m-p/583503#M18755</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-08-23T15:09:31Z</dc:date>
    </item>
    <item>
      <title>Re: SG annotation help</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SG-annotation-help/m-p/583555#M18760</link>
      <description>&lt;P&gt;Unless having the two bits of text above and below the reference line is super critical then perhaps just using a LABEL with the proper options such as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sgplot data=sashelp.class;
   scatter x=height y=weight;
   refline 95 / axis=Y label="Meaning text*Ref @ 95"
                labelloc=inside  labelpos=max
    splitchar='*' splitjustify= right
   ;
run;&lt;/PRE&gt;
&lt;P&gt;The splitchar&amp;nbsp; will vertically split the text of the label at the *, the justification set both pieces to display right justified and labelloc and labelpos put the text at the right side of the reference line inside the graph. Labelattrs options would let you set the text color, font family, size, style and weight. Or use a reference to a style attribute such as GraphTitleText .&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 17:11:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SG-annotation-help/m-p/583555#M18760</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-08-23T17:11:01Z</dc:date>
    </item>
    <item>
      <title>Re: SG annotation help</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SG-annotation-help/m-p/583560#M18762</link>
      <description>&lt;P&gt;I modified my code like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sgplot data=datafile2(where=(_visit_="Screening")) /*sganno=anno_n*/;&lt;BR /&gt;scatter x=meanm1m2 y=diffm1m2/ markerattrs=(color=green) tip=(meanm1m2 diffm1m2);&lt;BR /&gt;refline lldiffm1m22 / axis=y lineattrs=(color=red pattern=4 thickness=2pt)&lt;BR /&gt;label="Mean * lldiffm1m22" labelloc=inside labelpos=max splitchar="*" splitjustify=right;&lt;BR /&gt;refline mdiffm1m2/ axis=y lineattrs=(color=blue thickness=2pt);&lt;BR /&gt;refline uldiffm1m22/ axis=y lineattrs=(color=red pattern=4 thickness=2pt);&lt;BR /&gt;yaxis label='Day 1 - Day 2' labelattrs=(style=normal );&lt;BR /&gt;xaxis label='Mean of Day 1 and Day 2';&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It didn't work...I tried ti use labek yesterday as well, but it didn't work...I don't know why.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 17:30:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SG-annotation-help/m-p/583560#M18762</guid>
      <dc:creator>VinnyR</dc:creator>
      <dc:date>2019-08-23T17:30:42Z</dc:date>
    </item>
    <item>
      <title>Re: SG annotation help</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SG-annotation-help/m-p/583564#M18763</link>
      <description>Is there an error in the log?</description>
      <pubDate>Fri, 23 Aug 2019 17:40:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SG-annotation-help/m-p/583564#M18763</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-08-23T17:40:29Z</dc:date>
    </item>
    <item>
      <title>Re: SG annotation help</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SG-annotation-help/m-p/583565#M18764</link>
      <description>&lt;P&gt;No.....no error&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 17:42:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SG-annotation-help/m-p/583565#M18764</guid>
      <dc:creator>VinnyR</dc:creator>
      <dc:date>2019-08-23T17:42:30Z</dc:date>
    </item>
    <item>
      <title>Re: SG annotation help</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SG-annotation-help/m-p/583566#M18765</link>
      <description>&lt;P&gt;Post the log please.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/158682"&gt;@VinnyR&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;No.....no error&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 17:45:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SG-annotation-help/m-p/583566#M18765</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-08-23T17:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: SG annotation help</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SG-annotation-help/m-p/583568#M18766</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/158682"&gt;@VinnyR&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I modified my code like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sgplot data=datafile2(where=(_visit_="Screening")) /*sganno=anno_n*/;&lt;BR /&gt;scatter x=meanm1m2 y=diffm1m2/ markerattrs=(color=green) tip=(meanm1m2 diffm1m2);&lt;BR /&gt;refline lldiffm1m22 / axis=y lineattrs=(color=red pattern=4 thickness=2pt)&lt;BR /&gt;label="Mean * lldiffm1m22" labelloc=inside labelpos=max splitchar="*" splitjustify=right;&lt;BR /&gt;refline mdiffm1m2/ axis=y lineattrs=(color=blue thickness=2pt);&lt;BR /&gt;refline uldiffm1m22/ axis=y lineattrs=(color=red pattern=4 thickness=2pt);&lt;BR /&gt;yaxis label='Day 1 - Day 2' labelattrs=(style=normal );&lt;BR /&gt;xaxis label='Mean of Day 1 and Day 2';&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It didn't work...I tried ti use labek yesterday as well, but it didn't work...I don't know why.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Doesn't work 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 {i} 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-dat" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat&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;Could you run the exact code that I showed using the SASHELP.CLASS data set? If that runs and your code doesn't then you may have an issue with your data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you mean that the LABEL text did not have the value of a &lt;STRONG&gt;variable&lt;/STRONG&gt; then you need to modify the value of the variable. If you use Label="some text* variablename" then the text inside the quotes is what you get: "some text variablename" though the variable name should be on a second line. Text or Variable, not both.&lt;/P&gt;
&lt;P&gt;You may need to use a macro variable to have the value in the Label text as the SPLITCHAR option does not appear to apply to variable values, only literal text. Which may make &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;'s suggestion more attractive.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 17:50:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SG-annotation-help/m-p/583568#M18766</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-08-23T17:50:57Z</dc:date>
    </item>
    <item>
      <title>Re: SG annotation help</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SG-annotation-help/m-p/583573#M18767</link>
      <description>&lt;PRE&gt;1624
1625
1626
1627  options nonumber nodate;
1628  ods graphics / reset width=1200px height=700px
1628! imagename='Full' ;
1629  ods listing close;
1630  ods escapechar='~';
1631  ODS rtf FILE = "&amp;amp;outpath.&amp;amp;output..rtf";
NOTE: Writing RTF Body file: S:\statpgm\dev\avi-4658\4658-301\final\outputs\adhoc\sample.rtf
1632  symbol value=dot interpol=join repeat=100;
1633  ods graphics / reset width=1200px height=700px imagename='Full';
1634
1635  title1 j=c  "Bland-Altman Plot for Day 1 and Day 2 observed values at Screening, 6 Min WT
1635!  Dist.";
1636  title2 j=c "Efficacy Set";
1637  footnote1 " ";
1638
1639  proc sgplot data=datafile2(where=(_visit_="Screening")) /*sganno=anno_n*/;
1640  scatter x=meanm1m2 y=diffm1m2/ markerattrs=(color=green) tip=(meanm1m2 diffm1m2);
1641  refline lldiffm1m22 / axis=y lineattrs=(color=red pattern=4 thickness=2pt)
1642        label="Mean * lldiffm1m22" labelloc=inside labelpos=max splitchar="*"
1642! splitjustify=right;
1643  refline mdiffm1m2/ axis=y lineattrs=(color=blue thickness=2pt);
1644  refline uldiffm1m22/ axis=y lineattrs=(color=red pattern=4 thickness=2pt);
1645  yaxis label='Day 1 - Day 2' labelattrs=(style=normal );
1646  xaxis label='Mean of Day 1 and Day 2';
1647  run;

NOTE: PROCEDURE SGPLOT used (Total process time):
      real time           1.49 seconds
      cpu time            0.59 seconds

WARNING: WIDTH exceeds available space for RTF destination. Setting WIDTH=11520px.
NOTE: CURVELABEL='Mean * lldiffm1m22' is invalid. The option value cannot be a string when a
      column of reference lines is plotted. The label will not be drawn.
NOTE: CURVELABEL='Mean * lldiffm1m22' is invalid. The option value cannot be a string when a
      column of reference lines is plotted. The label will not be drawn.
NOTE: There were 327 observations read from the data set
      WORK.DATAFILE2.
      WHERE _visit_='Screening';

1648
1649  ods rtf close;
1650  ods listing;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture2.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31996i214531BB9504924B/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture2.PNG" alt="Capture2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 17:56:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SG-annotation-help/m-p/583573#M18767</guid>
      <dc:creator>VinnyR</dc:creator>
      <dc:date>2019-08-23T17:56:45Z</dc:date>
    </item>
    <item>
      <title>Re: SG annotation help</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SG-annotation-help/m-p/583576#M18768</link>
      <description>&lt;P&gt;Your annotate code has inputs from another data set. Make sure your rename any variables you use from that data set to names used by SGANNO, or your annotation will not work. I created a simple example below that simulates what you're trying to accomplish.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;BR /&gt;Dan&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data anno;
length anchor $ 11;
retain id "myid" function "text" x1space "wallpercent" y1space "datavalue" x1 100 width 40;
input label $ 1-16 y1 anchor $;
cards;
The top label     65 bottomright
The bottom label  65 topright
;
run;

proc sgplot data=sashelp.class sganno=anno;
scatter x=weight y=height;
refline 65;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 23 Aug 2019 18:04:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SG-annotation-help/m-p/583576#M18768</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2019-08-23T18:04:24Z</dc:date>
    </item>
    <item>
      <title>Re: SG annotation help</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SG-annotation-help/m-p/583583#M18769</link>
      <description>&lt;P&gt;The label probably works only if refline variable is a constant(number). Try using refline with variable name, then label does not work. Also, I did not understand the note from the log I posted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I really appreciate everyone's help. I am trying the other methods posted as well.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vinny&lt;/P&gt;</description>
      <pubDate>Fri, 23 Aug 2019 18:36:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SG-annotation-help/m-p/583583#M18769</guid>
      <dc:creator>VinnyR</dc:creator>
      <dc:date>2019-08-23T18:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: SG annotation help</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SG-annotation-help/m-p/583991#M18782</link>
      <description>&lt;P&gt;Thanks Reeza, appreciate your help..Kudos!&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;BR /&gt;&lt;BR /&gt;proc sort data=datafile3;
  by rstestcd meanm1m2;
run;   

data anno11(keep=rstestcd col1 ) anno22(keep=rstestcd col2 ) anno33(keep=rstestcd _visit_ usubjid newcol_ y1 y2 texty1 texty2);
    set datafile3;
    by rstestcd meanm1m2;
	length texty1 texty2 $ 20;;
	if newcol_=mdiffm1m2_ then do; y1=mdiffm1m2_+0.5; y2=mdiffm1m2_-0.5; texty1="Mean"; texty2=strip(put(mdiffm1m2_,best.)); end;
	if newcol_=lldiffm1m22_ then do; y1=lldiffm1m22_+0.5; y2=lldiffm1m22_-0.5; texty1="-1.96 SD"; texty2=strip(put(lldiffm1m22_,best.)); end;
	if newcol_=uldiffm1m22_ then do; y1=uldiffm1m22_+0.5; y2=uldiffm1m22_-0.5; texty1="+1.96 SD"; texty2=strip(put(uldiffm1m22_,best.)); end;
	output anno33;
    if last.rstestcd then do; col1=meanm1m2;output anno11;end;
    if first.rstestcd then do;  col2=meanm1m2;output anno22;end;
run;

data anno_1;
  merge anno11 anno22;
  by rstestcd;
  x=((col1-col2)*4.9/5)+col2;
run;

data f31;
  merge datafile3 anno_1;
  by rstestcd;
run;

proc sort data=anno33;
  by _visit_ rstestcd usubjid newcol_;
run;

proc sort data=f31;
  by _visit_ rstestcd usubjid newcol_;
run;

data f32;
   merge f31 anno33;
   by _visit_ rstestcd usubjid newcol_;
 run;

options nonumber nodate;
ods graphics / reset width=1200px height=700px imagename='Full' ;
ods listing close; 
ods escapechar='~';
ODS rtf FILE = "&amp;amp;outpath.&amp;amp;output..rtf";
symbol value=dot interpol=join repeat=100;
ods graphics / reset width=1200px height=700px imagename='Full';

title1 j=c  "Bland-Altman Plot for Day 1 and Day 2 observed values at Screening, NSAA Total Score";
title2 j=c "Efficacy Set";
footnote1 " ";

proc sgplot data=f2(where=(_visit_="Screening")) noautolegend /*sganno=anno_n*/;
scatter x=meanm1m2 y=diffm1m2/ markerattrs=(color=green) tip=(meanm1m2 diffm1m2);
refline lldiffm1m22 / axis=y lineattrs=(color=red pattern=4 thickness=2pt);
refline mdiffm1m2/ axis=y lineattrs=(color=blue thickness=2pt);
refline uldiffm1m22/ axis=y lineattrs=(color=red pattern=4 thickness=2pt);
yaxis label='Day 1 - Day 2' labelattrs=(style=normal );
xaxis label='Mean of Day 1 and Day 2';
text x=x y=y1 text=texty1/ textattrs=(color=gray size=6pt);
text x=x y=y2 text=texty2/ textattrs=(color=gray size=6pt);
run;

ods rtf close; 
ods listing;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Aug 2019 17:02:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SG-annotation-help/m-p/583991#M18782</guid>
      <dc:creator>VinnyR</dc:creator>
      <dc:date>2019-08-26T17:02:19Z</dc:date>
    </item>
    <item>
      <title>Re: SG annotation help</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SG-annotation-help/m-p/584009#M18786</link>
      <description>Does this mean you have it working or you need further assistance? You have code - we can't run it without the same data. If you're having issues remember to include the log as well.</description>
      <pubDate>Mon, 26 Aug 2019 18:14:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SG-annotation-help/m-p/584009#M18786</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-08-26T18:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: SG annotation help</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SG-annotation-help/m-p/584558#M18790</link>
      <description>&lt;P&gt;Here's a complete example, using proc sql to calculate the statistics, and using annotate to draw the lines and the labels:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql noprint;&lt;BR /&gt;create table my_data as&lt;BR /&gt;select unique *, avg(weight) as mean, std(weight) as sd&lt;BR /&gt;from sashelp.class;&lt;BR /&gt;create table my_anno as select unique mean, sd&lt;BR /&gt;from my_data;&lt;BR /&gt;quit; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data my_anno; set my_anno;&lt;BR /&gt;layer='front';&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;/* annotate the lines */&lt;/STRONG&gt;&lt;BR /&gt;x1space='datapercent'; y1space='datavalue';&lt;BR /&gt;x2space='datapercent'; y2space='datavalue';&lt;BR /&gt;function='line'; linethickness=1;&lt;BR /&gt;linecolor='red'; x1=0; y1=mean+1.96*sd; x2=100; y2=mean+1.96*sd; output;&lt;BR /&gt;linecolor='blue'; x1=0; y1=mean; x2=100; y2=mean; output;&lt;BR /&gt;linecolor='red'; x1=0; y1=mean-1.96*sd; x2=100; y2=mean-1.96*sd; output;&lt;BR /&gt;&lt;STRONG&gt;/* annotate the text labels above &amp;amp; below each line */&lt;/STRONG&gt;&lt;BR /&gt;function='text'; textcolor='gray33'; textsize=9; textweight='normal';&lt;BR /&gt;width=100; widthunit='percent';&lt;BR /&gt;x1=100; y1=mean+1.96*sd;&lt;BR /&gt;anchor='bottomright'; label='+ 1.96 SD'; output;&lt;BR /&gt;anchor='topright'; label=trim(left(put(mean+1.96*sd,comma5.1))); output;&lt;BR /&gt;x1=100; y1=mean;&lt;BR /&gt;anchor='bottomright'; label='Mean'; output;&lt;BR /&gt;anchor='topright'; label=trim(left(put(mean,comma5.1))); output;&lt;BR /&gt;x1=100; y1=mean-1.96*sd;&lt;BR /&gt;anchor='bottomright'; label='- 1.96 SD'; output;&lt;BR /&gt;anchor='topright'; label=trim(left(put(mean-1.96*sd,comma5.1))); output;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sgplot data=my_data sganno=my_anno;&lt;BR /&gt;scatter y=weight x=height / markerattrs=(color=green) tip=(weight height);&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="sd_plot.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/32079iED13BCF4F937376B/image-size/large?v=v2&amp;amp;px=999" role="button" title="sd_plot.png" alt="sd_plot.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Aug 2019 13:46:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SG-annotation-help/m-p/584558#M18790</guid>
      <dc:creator>GraphGuy</dc:creator>
      <dc:date>2019-08-28T13:46:30Z</dc:date>
    </item>
  </channel>
</rss>

