BookmarkSubscribeRSS Feed
albertsamaniego
Fluorite | Level 6

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.

Capture.PNG

 

 

 

2 REPLIES 2
Ksharp
Super User
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;
albertsamaniego
Fluorite | Level 6

hi sorry for the confusion, what I mean is to add grid lines on the table highlighted below and not on the chart itself.

Capture.PNG

 

thanks for the reply anyway.

SAS INNOVATE 2024

Innovate_SAS_Blue.png

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. 

Register now!

How to Concatenate Values

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1607 views
  • 2 likes
  • 2 in conversation