******************************
* Program: shelflife.sas :
* Author: Joshua M. Tebbs :
* Date: 13 August 2005 :
* Example 1.4 (notes) :
******************************
*****************************************************************************
* NOTE: A "*" at the start of a line allows
you to put comments into your :
* program. It effectively tells SAS not to
try to run that line. :
* All commands in SAS must and with a
semicolon. That means you will put :
* one at the end of every line (as I'm doing
here), except when a :
* command takes more than one line. :
* :
* SAS doesn't care about capital or small
letters, so I use them below :
* to differentiate between commands and
variable or data set names :
* :
* Also, SAS doesn't mind skipped lines or
spaces, so leave lots of room :
* in your programs to make them easy to read.
:
*****************************************************************************
/*
Another way to comment out whole sections of
a program is to use the /
followed by a *, as shown above this
sentence. It tells SAS to ignore
everything it sees until it reaches a
reversal of the symbols (* followed by
/), as shown below this line.
*/
/* The "options" line allows you to specify
things like the number of
lines per page ("ps=60" lines below), and the
number of characters
per line ("ls=80" characters below).
*/
/*
You put titles on at the top of your output
using the TITLE statement.
You can put more than one line of titles on
by using TITLE1, TITLE2,
and so forth. After the TITLE statement,
enclose your title in single
quotes, as below, and finish the line with a
semicolon.
*/ ;
options
ps=60
ls=80
pageno=1
formdlim='_'
nodate;
/* Name the data set, input the variables,
and then input the data */
data
beverage;
input
days @@;
datalines;
262 188 234 203 212 212 301 225 241 211 231
227 217
252 206 281 251 219 268 231 279 243 241 290
249
run;
/* Print the data on the output */
proc
print
data=beverage;
title
'SHELF LIFE DATA FROM
BEVERAGE EXPERIMENT';
run;
/* Compute summary statistics for the data */
proc
means
data=beverage
n
mean
median
std
min
max
sum;
var
days;
title
'DESCRIPTIVE
STATISTICS FOR BEVERAGE DATA';
title2
'USING PROC MEANS';
run;
/* A different procedure (proc) to get
summary statistics */
/* I don't recommend using SAS for making
histograms. However, you could using
a 'histogram;' option*/
proc
univariate
data=beverage;
var
days;
title
'DESCRIPTIVE
STATISTICS FOR BEVERAGE DATA';
title2
'USING PROC
UNIVARIATE';
qqplot;
run;