<?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: ANYWAY to do 3 Y-axis?! in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/ANYWAY-to-do-3-Y-axis/m-p/975073#M25664</link>
    <description>&lt;P&gt;I use SQL to stitch. It comes up clean now.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 15 Sep 2025 13:09:06 GMT</pubDate>
    <dc:creator>hellohere</dc:creator>
    <dc:date>2025-09-15T13:09:06Z</dc:date>
    <item>
      <title>ANYWAY to do 3 Y-axis?!</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/ANYWAY-to-do-3-Y-axis/m-p/975006#M25659</link>
      <description>&lt;P&gt;Here is y2axis to to 2 Y. ANYWAY to 3 Y-axis with any PROC in SINGLE plot? Thanks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a post on this, but quite out-of-date,&amp;nbsp;&lt;A href="https://blogs.sas.com/content/graphicallyspeaking/2012/01/16/the-more-the-merrier/" target="_blank" rel="noopener"&gt;The more the merrier - Graphically Speaking&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Anyway new and convenient?!&lt;/P&gt;</description>
      <pubDate>Sun, 14 Sep 2025 10:04:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/ANYWAY-to-do-3-Y-axis/m-p/975006#M25659</guid>
      <dc:creator>hellohere</dc:creator>
      <dc:date>2025-09-14T10:04:15Z</dc:date>
    </item>
    <item>
      <title>Re: ANYWAY to do 3 Y-axis?!</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/ANYWAY-to-do-3-Y-axis/m-p/975007#M25660</link>
      <description>&lt;P&gt;Simply to let x1 x2 and dif have own Y-axis.&amp;nbsp; Thanks&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _temp;
do i=1 to 100;
	x1=sin(i/10)+5;x2=cos(i/10);
	dif=x1-x2; output;
end;
run;quit;

proc sgplot data=_temp;
series x=i y=x1;
series x=i y=x2;
series x=i y=dif/y2axis;
run;quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 14 Sep 2025 09:47:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/ANYWAY-to-do-3-Y-axis/m-p/975007#M25660</guid>
      <dc:creator>hellohere</dc:creator>
      <dc:date>2025-09-14T09:47:41Z</dc:date>
    </item>
    <item>
      <title>Re: ANYWAY to do 3 Y-axis?!</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/ANYWAY-to-do-3-Y-axis/m-p/975014#M25661</link>
      <description>&lt;P&gt;Additional axis such as you propose would require you to rescale the data of the 3rd (or 4th or 5th) to one of the existing Y or Y2 axis and then basically draw the desired axis as a separate graphic element to have these graphs appear in a single panel using the SGPlot procedure.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If having the separate series appear in separate panels would be acceptable the Proc SGPanel with some data reshaping to add a variable for the Panelby statement with options Columns=1 and Uniscale=Column and&amp;nbsp; use a single Y variable might work.&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;data _temp;
do i=1 to 100;
	x1=sin(i/10)+5;
   x2=cos(i/10);
	dif=x1-x2; 
   output;
end;
run;

proc transpose data=_temp out=temp_trans (rename=(_name_=panel))
  prefix=y
;
  by i;
  var x1 x2 dif; 
run;

proc sgpanel data=temp_trans;
   panelby panel/columns=1 uniscale=column;
   series x=i y=y1;
   label panel='Y variable';

run;quit;
&lt;/PRE&gt;
&lt;P&gt;Which would be extendable to more y values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Proc Transpose used here for a quick reshape of the data.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 14 Sep 2025 15:09:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/ANYWAY-to-do-3-Y-axis/m-p/975014#M25661</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2025-09-14T15:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: ANYWAY to do 3 Y-axis?!</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/ANYWAY-to-do-3-Y-axis/m-p/975069#M25662</link>
      <description>&lt;P&gt;You can not get job done&amp;nbsp; by the url you mentioned ? and why ?&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/graphicallyspeaking/2012/01/16/the-more-the-merrier/" target="_blank"&gt;https://blogs.sas.com/content/graphicallyspeaking/2012/01/16/the-more-the-merrier/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You want this ?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;


data have;
do i=1 to 100;
	x1=sin(i/10)+5;x2=cos(i/10);
	dif=x1-x2; output;
end;
run;




proc sql noprint;
select min(x1),max(x1) into :min_x1,:max_x1 from have;
select min(x2),max(x2) into :min_x2,:max_x2 from have;

select floor(min(x1)),ceil(max(x1)) into :min_y,:max_y from have;
quit;
/*specify the Y axis tick value*/
data axis;
do x1=&amp;amp;min_y to &amp;amp;max_y by 0.5;
 label_x1=x1;
 label_x2=&amp;amp;min_x2 +  (&amp;amp;max_x2-&amp;amp;min_x2) * (x1-&amp;amp;min_x1)/(&amp;amp;max_x1-&amp;amp;min_x1);
 output;
end;
  format label_x1 label_x2 10.2;
run;
proc sort data=have;by x1;run;
data want;
 merge have axis;
 by x1;
 _x2=&amp;amp;min_x1+ (&amp;amp;max_x1-&amp;amp;min_x1)* (x2-&amp;amp;min_x2)/(&amp;amp;max_x2-&amp;amp;min_x2) ;
run;
proc sort data=want;by i;run;
options missing=' ';
proc sgplot data=want;
series x=i y=x1/lineattrs=(color=red);
series x=i y=_x2/lineattrs=(color=blue);
series x=i y=dif/lineattrs=(color=green) y2axis;

yaxis values=(&amp;amp;min_y to &amp;amp;max_y  by 0.5) display=(novalues nolabel)  ;

yaxistable  label_x1/label='x1' position=left labelattrs=(color=red size=10) valueattrs=(color=red size=10) ;
yaxistable  label_x2/label='_x2' position=left labelattrs=(color=blue size=10) valueattrs=(color=blue size=10);
y2axis labelpos=top labelattrs=(color=green size=10) valueattrs=(color=green size=10);
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1757940302144.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/109966i8490464D37266D83/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1757940302144.png" alt="Ksharp_0-1757940302144.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>Mon, 15 Sep 2025 12:45:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/ANYWAY-to-do-3-Y-axis/m-p/975069#M25662</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-09-15T12:45:06Z</dc:date>
    </item>
    <item>
      <title>Re: ANYWAY to do 3 Y-axis?!</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/ANYWAY-to-do-3-Y-axis/m-p/975072#M25663</link>
      <description>&lt;P&gt;Many Thanks. This is what I need.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"Label_x1 Label_x2" takes too much spade. SO I switch to "_x1 _x2".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But somehow _x2 comes with mess.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
do i=1 to 100;
	x1=sin(i/10)+5;x2=cos(i/10);
	dif=x1-x2; output;
end;
run;

proc sql noprint;
select min(x1),max(x1) into :min_x1,:max_x1 from have;
select min(x2),max(x2) into :min_x2,:max_x2 from have;

select floor(min(x1)),ceil(max(x1)) into :min_y,:max_y from have;
quit;
/*specify the Y axis tick value*/
data axis;
do x1=&amp;amp;min_y to &amp;amp;max_y by 1.0;
 _x1=x1;
 _x2=&amp;amp;min_x2 +  (&amp;amp;max_x2-&amp;amp;min_x2) * (x1-&amp;amp;min_x1)/(&amp;amp;max_x1-&amp;amp;min_x1);
 output;
end;
format _x1 _x2 10.1;
run;
proc sort data=have;by x1;run;
data want;
 merge have axis;
 by x1;
 _x2=&amp;amp;min_x1+ (&amp;amp;max_x1-&amp;amp;min_x1)* (x2-&amp;amp;min_x2)/(&amp;amp;max_x2-&amp;amp;min_x2) ;
 format _x2 10.1;
run;
proc sort data=want;by i;run;
options missing=' ';
proc sgplot data=want;
series x=i y=x1/lineattrs=(color=red);
series x=i y=_x2/lineattrs=(color=blue);
series x=i y=dif/lineattrs=(color=green) y2axis;

yaxis values=(&amp;amp;min_y to &amp;amp;max_y  by 1) display=(novalues nolabel)  ;

yaxistable  _x1/position=left labelattrs=(color=red size=10) valueattrs=(color=red size=10) ;
yaxistable  _x2/position=left labelattrs=(color=blue size=10) valueattrs=(color=blue size=10);
y2axis labelpos=top labelattrs=(color=green size=10) valueattrs=(color=green size=10);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="plot.png" style="width: 640px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/109967iBBC50FC30B661A92/image-size/large?v=v2&amp;amp;px=999" role="button" title="plot.png" alt="plot.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Sep 2025 12:56:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/ANYWAY-to-do-3-Y-axis/m-p/975072#M25663</guid>
      <dc:creator>hellohere</dc:creator>
      <dc:date>2025-09-15T12:56:35Z</dc:date>
    </item>
    <item>
      <title>Re: ANYWAY to do 3 Y-axis?!</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/ANYWAY-to-do-3-Y-axis/m-p/975073#M25664</link>
      <description>&lt;P&gt;I use SQL to stitch. It comes up clean now.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Sep 2025 13:09:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/ANYWAY-to-do-3-Y-axis/m-p/975073#M25664</guid>
      <dc:creator>hellohere</dc:creator>
      <dc:date>2025-09-15T13:09:06Z</dc:date>
    </item>
    <item>
      <title>Re: ANYWAY to do 3 Y-axis?!</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/ANYWAY-to-do-3-Y-axis/m-p/975075#M25665</link>
      <description>&lt;P&gt;Notice I changed the code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are using my old code .&lt;/P&gt;
&lt;P&gt;Did you try my updated code ?&lt;/P&gt;
&lt;PRE&gt;data have;
do i=1 to 100;
	x1=sin(i/10)+5;x2=cos(i/10);
	dif=x1-x2; output;
end;
run;

proc sql noprint;
select min(x1),max(x1) into :min_x1,:max_x1 from have;
select min(x2),max(x2) into :min_x2,:max_x2 from have;

select floor(min(x1)),ceil(max(x1)) into :min_y,:max_y from have;
quit;
/*specify the Y axis tick value*/
data axis;
do x1=&amp;amp;min_y to &amp;amp;max_y by&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt; 0.5&lt;/STRONG&gt; &lt;/FONT&gt;;
 &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;label_x1&lt;/STRONG&gt;&lt;/FONT&gt;=x1;
 &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;label_x2&lt;/STRONG&gt;&lt;/FONT&gt;=&amp;amp;min_x2 +  (&amp;amp;max_x2-&amp;amp;min_x2) * (x1-&amp;amp;min_x1)/(&amp;amp;max_x1-&amp;amp;min_x1);
 output;
end;
&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;format label_x1 label_x2 10.1;&lt;/STRONG&gt;&lt;/FONT&gt;
run;
proc sort data=have;by x1;run;
data want;
 merge have axis;
 by x1;
 _x2=&amp;amp;min_x1+ (&amp;amp;max_x1-&amp;amp;min_x1)* (x2-&amp;amp;min_x2)/(&amp;amp;max_x2-&amp;amp;min_x2) ;
 format _x2 10.1;
run;
proc sort data=want;by i;run;
options missing=' ';
proc sgplot data=want;
series x=i y=x1/lineattrs=(color=red);
series x=i y=_x2/lineattrs=(color=blue);
series x=i y=dif/lineattrs=(color=green) y2axis;

yaxis values=(&amp;amp;min_y to &amp;amp;max_y  by&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt; 0.5&lt;/STRONG&gt;&lt;/FONT&gt;) display=(novalues nolabel)  ;

yaxistable  &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;label_x1/label='x1'&lt;/FONT&gt; &lt;/STRONG&gt;position=left labelattrs=(color=red size=10) valueattrs=(color=red size=10) ;
yaxistable  &lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;label_x2/label='_x2'&lt;/FONT&gt;&lt;/STRONG&gt; position=left labelattrs=(color=blue size=10) valueattrs=(color=blue size=10);
y2axis labelpos=top labelattrs=(color=green size=10) valueattrs=(color=green size=10);
run;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1757941810298.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/109968iE376070E2D8CED3B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1757941810298.png" alt="Ksharp_0-1757941810298.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>Mon, 15 Sep 2025 13:10:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/ANYWAY-to-do-3-Y-axis/m-p/975075#M25665</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-09-15T13:10:13Z</dc:date>
    </item>
    <item>
      <title>Re: ANYWAY to do 3 Y-axis?!</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/ANYWAY-to-do-3-Y-axis/m-p/975078#M25666</link>
      <description>&lt;P&gt;OK NOW. Thanks.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&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="P2.png" style="width: 640px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/109969i86093813A3E27EFD/image-size/large?v=v2&amp;amp;px=999" role="button" title="P2.png" alt="P2.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Sep 2025 13:15:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/ANYWAY-to-do-3-Y-axis/m-p/975078#M25666</guid>
      <dc:creator>hellohere</dc:creator>
      <dc:date>2025-09-15T13:15:21Z</dc:date>
    </item>
  </channel>
</rss>

