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

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:

 

 

 

 

 

 

 

 

 

tags: PROC GCHART, PROC SGPLOT, ron cody, sas author, sas author's tip, sas book, sas press, sas statistics, sas tip

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <p> <pre lang="" line="" escaped=""> <q cite=""> <strike> <strong>