<?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 textsize for specific values in proc sgplot in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Changing-textsize-for-specific-values-in-proc-sgplot/m-p/960867#M374674</link>
    <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to change the text size of a specific values in yaxistable in a PROC SGPLOT. To do this, I wanted to use an attribute map with the dattrmap option by modifying the textsize based on an index ("id"). However, the textsize option does not seem to work. Is it not available for an attribute map ? How can I achieve this ?&lt;/P&gt;&lt;P&gt;Here is the reproductible code :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data test;
	input study :$30. n HR min max;
datalines;
study1 1 2.33 1.8 3.01
study2 2 1.72 1.33 2.22
study3 3 2.88 2.31 3.59
study4 4 1.9 1.55 2.33
study5 5 1.43 0.9  2.27
study6 6 1.63 1.29 2.06
study7 7 1.96 0.85 4.28
study8 8 1.46 1.13 1.88
study9 9 0.83 0.52 1.32
study10 10 1.56 0.87 2.79
study11 11 2.01 1.62 2.49
;
run;

data test;
	set test;
	if n in (1, 5, 8) then id=1; 
		else if n in (4, 10) then id=2;
		else id=3;
run;

data attrmap;
	length textweight $10;
	id='text'; value='1'; textcolor='Black'; textsize=8; textweight='bold'; textstyle='normal'; output;
	id='text'; value='2'; textcolor='Black'; textsize=7; textweight='normal'; textstyle='italic'; output;
	id='text'; value='3'; textcolor='Red'; textsize=4; textweight='normal'; textstyle='normal'; output;
run;

title;
ods graphics / height=5in width=6in;
proc sgplot data=test dattrmap=attrmap noautolegend;

		styleattrs axisextent=data;
		highlow y=n low=MIN high=MAX / lineattrs=(color=black);
		scatter y=n x=HR / markerattrs=(symbol=squarefilled color=black);
		scatter y=n x=HR / markerattrs=(size=0) x2axis; 
		refline 1 / axis=x;

		yaxistable study / nolabel location=inside position=left textgroup=id textgroupid=text;

		yaxis reverse display=none colorbands=odd colorbandsattrs=(transparency=1) offsetmin=0.02;
		xaxis display=(nolabel) VALUEATTRS=(size=8pt);
		x2axis display=(nolabel noline noticks novalues);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thank you for your help&lt;/P&gt;&lt;P&gt;Guillaume&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;</description>
    <pubDate>Tue, 04 Mar 2025 17:55:09 GMT</pubDate>
    <dc:creator>Guillaume21</dc:creator>
    <dc:date>2025-03-04T17:55:09Z</dc:date>
    <item>
      <title>Changing textsize for specific values in proc sgplot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-textsize-for-specific-values-in-proc-sgplot/m-p/960867#M374674</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to change the text size of a specific values in yaxistable in a PROC SGPLOT. To do this, I wanted to use an attribute map with the dattrmap option by modifying the textsize based on an index ("id"). However, the textsize option does not seem to work. Is it not available for an attribute map ? How can I achieve this ?&lt;/P&gt;&lt;P&gt;Here is the reproductible code :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data test;
	input study :$30. n HR min max;
datalines;
study1 1 2.33 1.8 3.01
study2 2 1.72 1.33 2.22
study3 3 2.88 2.31 3.59
study4 4 1.9 1.55 2.33
study5 5 1.43 0.9  2.27
study6 6 1.63 1.29 2.06
study7 7 1.96 0.85 4.28
study8 8 1.46 1.13 1.88
study9 9 0.83 0.52 1.32
study10 10 1.56 0.87 2.79
study11 11 2.01 1.62 2.49
;
run;

data test;
	set test;
	if n in (1, 5, 8) then id=1; 
		else if n in (4, 10) then id=2;
		else id=3;
run;

data attrmap;
	length textweight $10;
	id='text'; value='1'; textcolor='Black'; textsize=8; textweight='bold'; textstyle='normal'; output;
	id='text'; value='2'; textcolor='Black'; textsize=7; textweight='normal'; textstyle='italic'; output;
	id='text'; value='3'; textcolor='Red'; textsize=4; textweight='normal'; textstyle='normal'; output;
run;

title;
ods graphics / height=5in width=6in;
proc sgplot data=test dattrmap=attrmap noautolegend;

		styleattrs axisextent=data;
		highlow y=n low=MIN high=MAX / lineattrs=(color=black);
		scatter y=n x=HR / markerattrs=(symbol=squarefilled color=black);
		scatter y=n x=HR / markerattrs=(size=0) x2axis; 
		refline 1 / axis=x;

		yaxistable study / nolabel location=inside position=left textgroup=id textgroupid=text;

		yaxis reverse display=none colorbands=odd colorbandsattrs=(transparency=1) offsetmin=0.02;
		xaxis display=(nolabel) VALUEATTRS=(size=8pt);
		x2axis display=(nolabel noline noticks novalues);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thank you for your help&lt;/P&gt;&lt;P&gt;Guillaume&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Tue, 04 Mar 2025 17:55:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-textsize-for-specific-values-in-proc-sgplot/m-p/960867#M374674</guid>
      <dc:creator>Guillaume21</dc:creator>
      <dc:date>2025-03-04T17:55:09Z</dc:date>
    </item>
    <item>
      <title>Re: Changing textsize for specific values in proc sgplot SG Annotation Function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-textsize-for-specific-values-in-proc-sgplot/m-p/961200#M374734</link>
      <description>&lt;P&gt;The attribute&amp;nbsp;&lt;CODE class=" language-sas"&gt;textsize&lt;/CODE&gt; is available for data set &lt;CODE class=""&gt;sganno=&lt;/CODE&gt; but not for data set &lt;CODE class=""&gt;dattrmap=&lt;/CODE&gt; .&lt;/P&gt;
&lt;P&gt;See&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatproc/p1d3djir0t86nxn1l10ig8b2jbnl.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatproc/p1d3djir0t86nxn1l10ig8b2jbnl.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/grstatproc/n18szqcwir8q2nn10od9hhdh2ksj.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/grstatproc/n18szqcwir8q2nn10od9hhdh2ksj.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;So you need to overwrite the axis labels using the SG Annotation Function if you really want a different font size. That's done with something like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ANNO;
  DRAWSPACE='datavalue'; X1=0.25; Y1=3; FUNCTION='text'; TEXTSIZE=9; LABEL='Study 3'; output;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Set the axis labels to colour white.&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="ChrisNZ_0-1741341273343.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/105266iB5B494CB7A0F38EC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ChrisNZ_0-1741341273343.png" alt="ChrisNZ_0-1741341273343.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Mar 2025 09:55:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-textsize-for-specific-values-in-proc-sgplot/m-p/961200#M374734</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2025-03-07T09:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: Changing textsize for specific values in proc sgplot</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-textsize-for-specific-values-in-proc-sgplot/m-p/961287#M374762</link>
      <description>&lt;P&gt;TEXTSIZE= is not a valid&amp;nbsp;Reserved Variable .&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But you could use TEXT instead of YAXISTABLE.&lt;/P&gt;
&lt;PRE&gt;data test;
	input study :$30. n HR min max;
datalines;
study1 1 2.33 1.8 3.01
study2 2 1.72 1.33 2.22
study3 3 2.88 2.31 3.59
study4 4 1.9 1.55 2.33
study5 5 1.43 0.9  2.27
study6 6 1.63 1.29 2.06
study7 7 1.96 0.85 4.28
study8 8 1.46 1.13 1.88
study9 9 0.83 0.52 1.32
study10 10 1.56 0.87 2.79
study11 11 2.01 1.62 2.49
;
run;

data test;
	set test;
	if n in (1, 5, 8) then id=1; 
		else if n in (4, 10) then id=2;
		else id=3;
x=0.1;
if id=1 then study1=study;
if id=2 then study2=study;
if id=3 then study3=study;
run;


title;
ods graphics / height=5in width=6in;
proc sgplot data=test  noautolegend ;

		styleattrs axisextent=data;
		highlow y=n low=MIN high=MAX / lineattrs=(color=black);
		scatter y=n x=HR / markerattrs=(symbol=squarefilled color=black);
		scatter y=n x=HR / markerattrs=(size=0) x2axis; 
		refline 1 / axis=x;

		yaxistable study / nolabel location=inside position=left valueattrs=(size=0 color=white )  pad=(right=80);
text x=x y=n text=study1/strip contributeoffsets=none textattrs=(size=18 color=red);
text x=x y=n text=study2/strip contributeoffsets=none textattrs=(size=14 color=green weight=bold);
text x=x y=n text=study3/strip contributeoffsets=none textattrs=(size=10 color=navy  weight=bold);


		yaxis reverse display=none colorbands=odd colorbandsattrs=(transparency=1) offsetmin=0.02;
		xaxis display=(nolabel) min=0.5 VALUEATTRS=(size=8pt);
		x2axis display=(nolabel noline noticks novalues);
run;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1741484404084.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/105297i84ED613EAA8710B5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1741484404084.png" alt="Ksharp_0-1741484404084.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Mar 2025 01:40:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-textsize-for-specific-values-in-proc-sgplot/m-p/961287#M374762</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-03-09T01:40:10Z</dc:date>
    </item>
    <item>
      <title>Re: Changing textsize for specific values in proc sgplot SG Annotation Function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-textsize-for-specific-values-in-proc-sgplot/m-p/961397#M374798</link>
      <description>&lt;P&gt;ok thanks, it works fine.&lt;BR /&gt;But do I have to list each item? Isn't it possible to do it with an identifier? The aim is to include the graphic in a macro and change the text size according to an identifier (because the label can change).&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 10 Mar 2025 09:53:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-textsize-for-specific-values-in-proc-sgplot/m-p/961397#M374798</guid>
      <dc:creator>Guillaume21</dc:creator>
      <dc:date>2025-03-10T09:53:25Z</dc:date>
    </item>
  </channel>
</rss>

