I would really like to use block statements on the y axis. I make a lot of plots on depth where you usually have the y-axis as your "normal" x-axis and the value on the X..
Vbarparm works nice
While hparparm does not work nice
Whenever I try to use block on the Y-axis SAS says it does not support so. Does anybody have a work around?
A question to SAS is why can't this be supported?
The code for creating the graphs are below.
Looking at the generated GTL templates they are equal with the exception that the horisontal has an orient = horizontal added. This tells me that it basically treats the plot the same. However you cant just use orient on the block plot.
Here is the code to reproduce.
proc hpbin data=sashelp.class numbin=5;
var weight;
ods output mapping=map;
run;
/*Add a block variable*/
data map;
set map;
length block $ 8;
if bin=1 then block='Low';
else if bin=5 then block='High';
else block='Middle';
/*Fixing frequencies to show problem better*/
frequency= frequency*10;
run;
ods graphics on / heighyt=300 px width=400 px;
/*This is nice*/
proc sgplot data=map tmplout='/shared/winshare/teams_no/AnalyticalFiles/vbarparm.txt';
vbarparm category=bin response=frequency;
block X=bin block=block / transparency=0.9;
run;
/*This is not nice*/
proc sgplot data=map tmplout='/shared/winshare/teams_no/AnalyticalFiles/hbarparm.txt';;
hbarparm category=bin response=frequency;
block x=bin block=block / transparency=0.9;
/*Block only responds to x variable*/
run;
I don't think PROC SGPLOT supports horizontal BLOCKs. You would have to emulate them by using the POLYGON statement or use annotation.
Thanks Rick, can you say anything about why? It seems like it is relativly easy to do as the GTL is more or less just switching axis. A band plot and a High - low with a bit of the same behaviour seem to handle this. Creating a large set of polygons is a bit cumbersome, but probably completely doable.
Are there any plans to add in next version?
No, I do not have any insight into why. Most likely the reason is that PROC SGPLOT is designed to handle the common cases that 95% of the people want 95% of the time. Until someone like you asks for a feature, the development team might not know that it is wanted by customers.
I would encourage you to ask for this feature if it is important to you. Like you, I have sometimes needed this feature and lamented that it was not in SGPLOT.
OK,
I'll post it as a wish if I remember how.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.