Hi is it possible to add gridlines on the xaxistable on the proc sgplot?
here's my sample code. Note that I only created a dummy data named sample data set.
/*create sample data*/
data sample;
brand = "Brand1";count = 10;Month = 1;output;
brand = "Brand1";count = 22;Month = 2;output;
brand = "Brand1";count = 12;Month = 3;output;
brand = "Brand2";count = 11;Month = 1;output;
brand = "Brand2";count = 31;Month = 2;output;
brand = "Brand2";count = 2;Month = 3;output;
brand = "Brand3";count = 21;Month = 1;output;
brand = "Brand3";count = 41;Month = 2;output;
brand = "Brand3";count = 11;Month = 3;output;
run;
/*plot graph*/
proc sgplot data=sample;
vbar brand /response=count group=Month groupdisplay=CLUSTER;
xaxistable count /colorgroup=Month location=inside nostatlabel valueattrs=(size=10 weight=normal) separator;
xaxis display=(nolabel noline noticks);
yaxis display=(noline noticks) grid;
run;
The resulting graph would be like this but I'm required to add gridlines on the table underneath the bar graph.
data sample;
brand = "Brand1";count = 10;Month = 1;output;
brand = "Brand1";count = 22;Month = 2;output;
brand = "Brand1";count = 12;Month = 3;output;
brand = "Brand2";count = 11;Month = 1;output;
brand = "Brand2";count = 31;Month = 2;output;
brand = "Brand2";count = 2;Month = 3;output;
brand = "Brand3";count = 21;Month = 1;output;
brand = "Brand3";count = 41;Month = 2;output;
brand = "Brand3";count = 11;Month = 3;output;
run;
/*plot graph*/
proc sgplot data=sample;
vbar brand /response=count group=Month groupdisplay=CLUSTER;
xaxistable count /colorgroup=Month location=inside nostatlabel
valueattrs=(size=10 weight=normal) separator;
xaxis display=(nolabel noline noticks); yaxis display=(noline noticks) grid;
refline "Brand1" "Brand2" "Brand3"/axis=x discreteoffset=0.3;
refline "Brand1" "Brand2" "Brand3"/axis=x discreteoffset=-0.3;
refline "Brand1" "Brand2" "Brand3"/axis=x;
run;
hi sorry for the confusion, what I mean is to add grid lines on the table highlighted below and not on the chart itself.
thanks for the reply anyway.
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.