Simple PROC BOXPLOT example

Here’s a simple PROX BOXPLOT showing how to produce Box and Whisker graphs in SAS.

data presidents;
input name $ cm 3.;
George_W_Bush 183.1
George_W_Bush 182.9
George_W_Bush 183.3
George_W_Bush 188.3
Barrack_Obama 188.0
Barrack_Obama 188.9
Barrack_Obama 187.5
Barrack_Obama 180 /* a terrible measurement */
Lyndon_Johnson 192.3
Lyndon_Johnson 192.1
Lyndon_Johnson 191.6

proc boxplot data=presidents;
plot cm * name;
title "Heights of US Presidents";
name = 'Name'
cm = 'Height (centimeters)';
footnote "Some imprecise measurements included to illustrate the box plot.";
footnote2 "Original data:";

To output to other software via PNG or (yuck) GIF, try ODS HTML.

SAS requires an extra license for graphing. This reminds me while I like R, an open source competitor.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s