SAS author's tip: creating a bar chart using PROC SGPLOT

0

This week's tip comes from Ron Cody - SAS author and expert extraordinaire. Ron's written several bestselling SAS Press books including his latest SAS Statistics by Example. If you haven't taken a look at Ron's extensive work, I'd invite you to visit his author page. You can read a free chapter from each of his books, listen to short podcast interviews with him, view awards he's won, and see my favorite author photo of all time. Ron will also be attending several conferences this year, including SAS Global Forum in Orlando. If you get a chance to hear him speak, don't pass it up!

You can view additional SAS tips from Ron Cody in these blog posts: Computing a new variable with PROC REPORT and  SPEDIS and fuzzy matching.

The following excerpt is from SAS Press author Ron Cody and his book "SAS Statistics by Example" Copyright © 2011, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED. (please note that results may vary depending on your version of SAS software)

Creating a Bar Chart Using PROC SGPLOT

You can create a similar bar chart using PROC SGPLOT. A number of built-in styles make it very easy to customize your output. For example, a style called JOURNAL produces black and white output, suitable for publication in a journal. A style called STATISTICAL gives you output that is designed for statistical purposes.

Program 3.7 shows how to produce a chart similar to the one produced in Program 3.6:

Program 3.7: Generating a Bar Chart Using PROC SGPLOT

title "Generating a Bar Chart - Using PROC SGPLOT";
proc sgplot data=store;
vbar Region;
run;

The syntax is almost identical to PROC GCHART. You enter the keyword VBAR, followed by one or more variables for which you want to create a bar chart. Here is the output:

 

 

 

 

 

 

 

 

 

Share

About Author

Shelly Goodin

Social Media Specialist, SAS Publications

Shelly Goodin is SAS Publications' social media marketer and the editor of "SAS Publishing News". She’s worked in the publishing industry for over thirteen years, including seven years at SAS, and enjoys creating opportunities for fans of SAS and JMP software to get to know SAS Publications' many offerings and authors.

Related Posts

Comments are closed.

Back to Top