05-17-2015 05:46 AM
Can we get second y-axis using "Proc SGpanel" ?
By using SGPlot we can achieve by it by "y2axis" statement but how do we get it by using SGPanel procedure.
is it possible ?
Thanks in advance.
05-17-2015 07:16 AM
You can get an axis on the right side, but it has to be the same as the Y axis. Y2AXIS option on the plot statement is not supported in SGPANEL.
This is where you will need to move up to GTL. Bar Chart and other BASIC plot statements are allowed in Layout DataLattice. But not statements that need data summarization like Histogram, etc. If you need those, you will have to summarize (or min) the data yourself. GTL code attached:
Should work with SAS 9.3. But Columnweight=Proportional needs SAS 9.4.
define statgraph Y2Panel;
entrytitle 'Mileage and Horsepower by Origin and Type';
layout datalattice columnvar=origin / headerlabeldisplay=value columnweight=proportional
barchart x=type y=mpg_city / discreteoffset=-0.2 name='a'
barwidth=0.4 stat=mean fillattrs=graphdata1;
barchart x=type y=horsepower / discreteoffset=0.2 barwidth=0.4
stat=mean yaxis=y2 fillattrs=graphdata2 name='b';
sidebar / spacefill=false;
discretelegend 'a' 'b';
ods html close;
ods graphics / reset width=8in height=4in imagename='Y2Panel';
proc sgrender data=sashelp.cars(where=(type ne 'Hybrid')) template=Y2Panel;
05-17-2015 08:57 PM
Thank you for your advice, I have idea of GTL and i am using it to produce Yaxis on right side. Just want to know is there any possibility of getting it by SGPANEL.
Thanks once again for you answer and advice.