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.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.
Ready to level-up your skills? Choose your own adventure.