Data visualization with SAS programming

How to add reference line to each bar in SAS GTL

Reply
New Contributor
Posts: 2

How to add reference line to each bar in SAS GTL

[ Edited ]

I am trying to add a reference line to each bar in SAS GTL. I know I have target= in barchartparm but I need to customize the line to dashed, which I can not find anyway to do that in barchartparm.

I tried scatterplot and symbolchar to overlay a "DASHED LINE" unicode but the issue is the unicode I used is not vertical centered. It cannot be placed right at the data point. I tried vertical offset to fix it then another issue is in the legend, the same symbol char was used but if I changed the size of the symbol in legend it resulted in so much space in the legend box then the figure became too long.

I wanna ask are there some other way to get around this? or some magical normal dashed line unicode that I can use? I searched so many some just gave me a empty box which I do not understand why.

Thank you so much for your help!

 

Here are the part of the code:

proc template;
define statgraph &st.&yr.&pp.TopBox;
BeginGraph / DesignWidth = &Height.in ;

symbolchar name=line char='2508'x /voffset= 0.39 ;
symbolchar name=linelengend char='2508'x /voffset= 0.3;

discreteattrmap name = "line";
Value "1" /markerattrs=(symbol=line color=black size = 0.8in);

enddiscreteattrmap;
discreteattrvar attrvar = drawline var = line attrmap = "line";


legenditem type = marker name= "XXXX" / label="XXXX"
markerattrs = (Symbol = linelengend Color = black Size = 0.4in);

Layout Overlay / XXXXX ;
/* Create Bars */
BarChartPARM x = XXXX y = XXXXX / Group = PlanColor
GROUPORDER= reversedata
GroupDisplay = Cluster
CLUSTERWIDTH = 0.5
Orient = vertical
DataSkin = &DataSkin.
/* DATALABEL = XXXX*/
/* DISCRETEOFFSET = -0.2*/
datalabelattrs=(size=10 weight=bold)
ERRORLOWER = Lower_CI
ERRORUPPER = Upper_CI
/* target = XXXX*/
;

ScatterPlot x = XXXXX y = XXXXX / Group = drawline
GROUPORDER = reversedata
GroupDisplay = Cluster
/* DATALABEL = XXXXX*/
;

DiscreteLegend "XXX" / Border = Yes
ValueAttrs = (Family = "Calibri" Color = Black Size = 10)
;

SAS Super FREQ
Posts: 1,184

Re: How to add reference line to each bar in SAS GTL

Posted in reply to Pepsimax2

It is easier to help if you post your current code with sample data and output.  Also the SAS release number.

New Contributor
Posts: 2

Re: How to add reference line to each bar in SAS GTL

Posted in reply to Sanjay_SAS

Just edited the post! Thank you

SAS Super FREQ
Posts: 1,184

Re: How to add reference line to each bar in SAS GTL

[ Edited ]
Posted in reply to Pepsimax2

Please supply FULL code (with any macro variables values) and sample data so we can run your program to see what is going on.  Please include SAS release number.

Ask a Question
Discussion stats
  • 3 replies
  • 64 views
  • 0 likes
  • 2 in conversation