<?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 sgplot 2 axes in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-2-axes/m-p/419509#M14446</link>
    <description>&lt;P&gt;split your y variable up in two different variables and spefify two distinct step statements, one for each new y variable and use the y2axis option in one of the step statements &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 08 Dec 2017 09:28:49 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2017-12-08T09:28:49Z</dc:date>
    <item>
      <title>proc sgplot 2 axes</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-2-axes/m-p/419503#M14445</link>
      <description>&lt;P&gt;Hello all,&lt;/P&gt;&lt;P&gt;I have this dataset:&lt;/P&gt;&lt;P&gt;id&amp;nbsp; &amp;nbsp; group&amp;nbsp; &amp;nbsp;x&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;y&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp;A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 10&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp;A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 30&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;10&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp;B&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 50&amp;nbsp; &amp;nbsp; &amp;nbsp; 400&lt;/P&gt;&lt;P&gt;1&amp;nbsp; &amp;nbsp; &amp;nbsp;A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;100&amp;nbsp; &amp;nbsp; &amp;nbsp; 15&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp;B&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;110&amp;nbsp; &amp;nbsp; &amp;nbsp; 800&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp;A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 20&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;11&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp;B&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;150&amp;nbsp; &amp;nbsp; &amp;nbsp; 600&lt;/P&gt;&lt;P&gt;2&amp;nbsp; &amp;nbsp; &amp;nbsp;A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 90&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 7&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp;A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;130&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;10&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp;A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 75&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 8&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp;B&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 60&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1200&lt;/P&gt;&lt;P&gt;3&amp;nbsp; &amp;nbsp; &amp;nbsp;B&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 50&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1400&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want to get is two curves in the same graph (using sgplot) for every id. The group A will&amp;nbsp;follow&amp;nbsp;xaxis and yaxis and the group B will follow xaxis and y2axis.&amp;nbsp; I didn't get the solution&amp;nbsp;using this code (I should change it a bit):&lt;/P&gt;&lt;P&gt;proc sgplot data=tab1;&lt;BR /&gt;by id;&lt;BR /&gt;title "#byval1" justify=center ;&lt;BR /&gt;step x=x y=y / justify=center group=group lineattrs=(pattern=solid thickness=0.8mm) ;&lt;BR /&gt;xaxis minor minorcount=4 offsetmin=0 offsetmax=0 type=linear values=(0 to 110 by 10) ;&lt;BR /&gt;yaxis minor minorcount=4 offsetmin=0 offsetmax=0 type=linear values=(0 to 15 by 1) ;&lt;BR /&gt;y2axis minor minorcount=4 offsetmin=0 offsetmax=0 type=linear values=(0 to 1600 by 200) ;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;any suggestion please ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2017 09:14:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-2-axes/m-p/419503#M14445</guid>
      <dc:creator>oussema</dc:creator>
      <dc:date>2017-12-08T09:14:33Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgplot 2 axes</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-2-axes/m-p/419509#M14446</link>
      <description>&lt;P&gt;split your y variable up in two different variables and spefify two distinct step statements, one for each new y variable and use the y2axis option in one of the step statements &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2017 09:28:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-2-axes/m-p/419509#M14446</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-12-08T09:28:49Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgplot 2 axes</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-2-axes/m-p/419519#M14447</link>
      <description>&lt;P&gt;I did but it doesn't work. Following your suggestion, it will read only the first step statement. I tried something different which is the following:&lt;/P&gt;&lt;P&gt;proc sgplot data=tab1;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;step x=x y=y / justify=center group=group lineattrs=(color=grey pattern=solid thickness=1.2mm) ;&lt;BR /&gt;step x=x y=y / y2axis justify=center group=extrt lineattrs=(color=green pattern=solid thickness=1.2mm) ;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;But I got 4 curves and not 2.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2017 10:46:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-2-axes/m-p/419519#M14447</guid>
      <dc:creator>oussema</dc:creator>
      <dc:date>2017-12-08T10:46:35Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgplot 2 axes</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-2-axes/m-p/419524#M14448</link>
      <description>&lt;P&gt;Right now, you are plotting 2 lines for each STEP statement because of your group= option.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Drop the GROUP= option in both of your statements because you handle these groups manually by splitting up y &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Dec 2017 10:55:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-2-axes/m-p/419524#M14448</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-12-08T10:55:50Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgplot 2 axes</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-2-axes/m-p/419557#M14449</link>
      <description>&lt;P&gt;Are you looking for something like this?&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-left" image-alt="img0.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/17091i1F88503CCB51A6E0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="img0.png" alt="img0.png" /&gt;&lt;/span&gt;&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;&amp;nbsp;&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;&amp;nbsp;&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;&amp;nbsp;&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;&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 plotdata;
  infile cards dlm=",";
  input
    id group $ x y
  ;

  if group = "A" then do;
    ya = y;
  end;

  if group = "B" then do;
    yb = y;
  end;
cards;
1,A,10,2
1,A,30,10
1,B,110,400
1,B,140,150
2,B,110,750
2,A,20,11
2,B,150,600
2,A,70,7
3,A,100,16
3,A,75,8
3,B,120,800
3,B,130,1200
;

proc sort data=plotdata;
  by x group id ;
run;


proc sgplot data=plotdata nocycleattrs;
  step x=x y=ya /
    justify=center group=id markers lineattrs=(pattern=solid thickness=0.8mm)
    datalabel
  ;
  step x=x y=yb /
    justify=center group=id markers lineattrs=(pattern=solid thickness=0.8mm)
    datalabel
    y2axis
  ;
&lt;/CODE&gt;&lt;/PRE&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;</description>
      <pubDate>Fri, 08 Dec 2017 13:58:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/proc-sgplot-2-axes/m-p/419557#M14449</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2017-12-08T13:58:01Z</dc:date>
    </item>
  </channel>
</rss>

