BookmarkSubscribeRSS Feed
celdelmas
Calcite | Level 5

Hi everyone,

 

I would like to konw if it is possible to create bar plots (VBARS for example) and set up the width of the bars according to a variable (the relative abundance of each category).

 

To illustrate my question, here is a plot from this paper (http://bit.ly/1nC991b)  (Figure 3b).

It is exactely the type of plot I need to do for a ungoing project!

Capture d’écran 2016-03-11 à 11.45.44.png"

"The width of the bars represents relative abundance and the black component indicates the proportion of generalist feeders within the whole community: the higher the bar, the greater the proportion" 

Gámez-Virués, S., Perović, D. J., Gossner, M. M., Börschig, C., Blüthgen, N., de Jong, H., ... & Scherber, C. (2015). Landscape simplification filters species traits and drives biotic homogenization. Nature communications, 6.

 

Here is the (simplified) code for the plot I am working on:

Habit is a categorical variable with 2 values.

size is a categorical variable with 3 values

cate_col is a categorical variable with 2 values

FreqLFcol_cate is a table obtained with PROC FREQ 

 

 

proc sort data=trait; by habit size;run;
proc freq data=trait;
by habit size;
table cate_flo / out=FreqLFcol_cate ;
run;

proc sgpanel data=FreqLFcol_cate;
panelby habit ;
vbar size / response=Percent group=cate_flo grouporder=data groupdisplay=stack;

rowaxis label = 'Percentage of species ' ;
colaxis label = 'size ';
run;

I would to set up the width of the bars according to the relative abundance of species in the "size" variable as done by Gámez-Virués et al. 2015.

 

Do you think it is possible in SAS?

 

Thank you very much for your advices!

 

2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

You may want to sort out your code box, its all on one line (i.e. put each code line on a newline, use indents etc.).  AS for your request, have a look here:

http://blogs.sas.com/content/graphicallyspeaking/

This has examples of every type of graph you can imagine.  For your type of graph, I would imagine polygon is probably the nearest:

http://blogs.sas.com/content/graphicallyspeaking/2013/12/24/new-polygon-plot/

celdelmas
Calcite | Level 5

Thank you for your quick reply, for some reason the code is all on one line, could not manage to change that.. not sure why.

I didn't know the polygon plots!! Looks perfect for my needs, I'll give it a try!

Thank you very much

 

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
  • 2 replies
  • 2725 views
  • 0 likes
  • 2 in conversation