BookmarkSubscribeRSS Feed
sesser
Calcite | Level 5

I am having trouble making a side by side verticle bar graph and I am wondering if my data are sorted poorly.

My data  are in the attached files which have not been working out.

I would like the figure to look like the attachment titled "capture"


Capture.JPG
4 REPLIES 4
Cynthia_sas
SAS Super FREQ

Hi:

  What code are you using? SAS/GRAPH and PROC GCHART or ODS GRAPHICS and PROC SGPLOT or???

    What is your destination of interest? HTML, RTF, PDF?

cynthia

sesser
Calcite | Level 5

The code I have been using with no luck is very similar to sanjay's response.

data y72 y13; set nototals

year=72; totalseed=Dc1_1972; output y72;

year13; totalseed=Dc1_2013, ouput y13;

run;

proc sgplot;

vbar year / group=year groupdisplay=cluster response=totalseed;

run;

this just gets the one group (Dc1) garphed when I want DC1, DC2 and DC3 all on the same graph

S

Jay54
Meteorite | Level 14

First - You are using the same variable (year) for both category and group. There is no distinct GROUP variable.  Second, the graph will depend on your data.  You need a column with DC1, DC2, etc. as values in the column, and this column should be provided as the GROUP role in the statement.

Jay54
Meteorite | Level 14

A smaller sample data with just what you need would be easier to work with.  If you have SAS 9.3 or higher, you can use the following SGPLOT example.  Substitute the appropriate data set, category, group and response variables.  "Cluster" is a keyword you must use.   

proc sgplot data=sashelp.cars;

vbar origin/ response=mpg_city group=type groupdisplay=cluster;

run;

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 4 replies
  • 760 views
  • 0 likes
  • 3 in conversation