I am attempting to edit the placement of data labels in a SERIES graph in PROC TEMPLATE. The default settings get me to 95% of what I need, but when I specify the DATALABELPOSITION option, results are not as I would expect and the plot becomes unusable.
Below is one panel that is problematic using the default settings (note the collision with the line):
Here is the same panel after specifying DATALABELPOSITION=BOTTOMRIGHT, thinking the label would simply move down slightly:
No matter what I try for DATALABELPOSITION, anything other than AUTO scrunches up the graph. Am I missing something that's making it put the label outside the graph/plot region? Pared down code is below.
proc template; define statgraph NAME; dynamic VAR; begingraph / designWidth=2700px designHeight=675px; layout dataLattice columnVar=COLVAR / headerLabelDisplay=value rowAxisOpts=(offsetmin=0 linearopts=(tickvalueformat=percent11.0 viewmin=0) display=(tickvalues ticks label)) columnAxisOpts=(display=(tickvalues ticks label)); layout prototype; referenceline x=XREF / lineattrs=(pattern=2 thickness=1); < More seriesplot statements > seriesplot x=XVAR y=YVAR / yaxis=y lineattrs=(color=&PLOTCOLOR thickness=2); seriesplot x=XVAR y=YVAR / yaxis=y display=(markers) markerattrs=(color=&PLOTCOLOR symbol=circleFilled) datalabel=YVAR2 datalabelattrs=(color=&PLOTCOLOR) datalabelposition=bottomright; endlayout; endlayout; endgraph; end; run;
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.