BookmarkSubscribeRSS Feed
PaalNavestad
Pyrite | Level 9

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

hbar.PNG

While hparparm does not work nice

vbar.PNG

 

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;

 

5 REPLIES 5
Rick_SAS
SAS Super FREQ

I don't think PROC SGPLOT supports horizontal BLOCKs. You would have to emulate them by using the POLYGON statement or use annotation.

PaalNavestad
Pyrite | Level 9

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?

Rick_SAS
SAS Super FREQ

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. 

PaalNavestad
Pyrite | Level 9

OK,

I'll post it as a wish if I remember how. 

Jay54
Meteorite | Level 14
It is not available in GTL either. Hence, it is not available in SGPLOT. Mostly because no one (initially) asked for this use case. It would help if you put in your request for this feature with Tech Support. The "InnerMargins" needed for this plot were initially only available for x-axis. Inner Margins for Y axis were added only recently. So, now it would be easier to implement a y-axis version of this plot.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

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

View all other training opportunities.

Discussion stats
  • 5 replies
  • 1212 views
  • 4 likes
  • 3 in conversation