Hi,
I have the below code that shows using uniform axis, the trended comparison between 2016 vs 2017. However, I'm trying to specify the legend into the chart but nothing works...any help would be appreciated. I would like two keys; one for '2017' and oanother for '2016'.
GOPTIONS RESET=ALL CBACK=WHITE BORDER HTITLE=12PT HTEXT=10PT;
SYMBOL INTERPOL=JOIN COLOR=BLACK VALUE=DOT;
LEGEND1 LABEL=(POSITION=(BOTTOM RIGHT) ) VALUE=('YR16' 'MTH_RENEW') ACROSS=1;
TITLE 'RENEWALS 2016 VS 2017';
PROC GBARLINE DATA=CVMGEN.EME_RNWLS_2017 UNIFORMAXES;
VBAR MTH_RENEW / SUMVAR=YR17 MAXIS=AXIS1 ;
PLOT / SUMVAR=YR16;
RUN;
QUIT;
Thanks
You need to tell the procedure to use the legend.
Add
Legend=Legend1
to the plot options for the BAR.
Also in GBARLINE the syntax for the bar is BAR not Vbar
Or move to Proc Sgplot.
Tried it. Doesn't work.
It only givens me YR16
LEGEND1 LABEL=(POSITION=(BOTTOM RIGHT) ) VALUE=('YR16' 'YR17') ACROSS=1;
TITLE 'GERMANY RENEWALS 2016 VS 2017';
PROC GBARLINE DATA=CVMGEN.EME_RNWLS_2017 UNIFORMAXES;
WHERE SBR_OFF_DESC = 'GERMANY';
BAR MTH_RENEW / SUMVAR=YR17 MAXIS=AXIS1 RAXIS=AXIS2 LEGEND=LEGEND1 AUTOREF CLIPREF ;
PLOT / SUMVAR=YR16 RAXIS=AXIS3 AUTOREF CLIPREF ;
RUN;
QUIT;
Can you move to SGPLOT? The quality of graphics are much better and the coding is simpler.
Without data we can't test code.
Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... 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.
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.