Professional Documents
Culture Documents
Greg Jenkins
1
Overview
• SAS procedures are functions that generally
take data in either from a data set, or
specified options, and then output some
information.
• That’s pretty vague, but we will look at
some basic SAS procedures for examples.
• Coding and options are similar for most
procedures.
2
Syntax Common to Most Procedures
• Most procedures have the following general
syntax:
6
Types of Procedures
• There are lots of them, but we’ll just discuss
a few groups, and few procedures within
those groups.
• First, we’ll look at base SAS procedures.
• The first procedures we’ll talk about are
report writing related: print, printto,
tabulate, and report.
7
Proc Print
• Used to output the contents of a SAS dataset.
• Basic syntax:
10
Basic Statistics Procedures
• The next group of basic procedures we’ll
talk about are procedures that do basic
statistics, like simple frequency
(contingency) tables, univariate statistics,
etc.
• These procedures are: proc univariate,
means, freq, rank, and corr.
11
Proc Univariate
• Calculates basic statistics for one variable,
mean, median, etc., also does tests.
proc freq;
table gender*smoke;
run;
16
Proc Freq
• Proc freq will do testing, approximate, and
exact.
• Outputs measures of association,
agreement, and odds ratios.
• Also has several output data sets.
17
Other Basic Statistics Procedures
• Proc rank, will output a data set of ranks
based on variables from an input dataset and
various options.
• Proc corr, outputs correlation type
information, for comparisons of two
continuous variables, also does non-
parametric comparisons.
18
Utility Procedures
• These procedures are utilities, they are for
the most part work with data sets, they: sort,
edit, copy, etc. They do not generally
produce output.
• Some of the procedures we have already
seen are: proc format, proc import(using the
import wizard), proc sql(we’ll talk about
later), and proc contents.
19
Brief Overview: Utility Procedures
21
Categories of Other Procedures
• SAS/ETS – statistical procedures, time
series tools
• SAS/FSP – data entry tools
• SAS/GIS – tools for GIS(Geographic
Information Systems) data
• SAS/GRAPH – graphics
• SAS/IML – Interactive matrix language
22
Categories of Other Procedures
• SAS/EIS – data warehousing tools
• SAS/QC – quality control procedures, like
proc capability(nice procedure for normal-
probability plots, etc.)
• And many, many more …
23
Output from Procedures
• Output for SAS procedures are generally
sent to the output window(interactive SAS)
or .lst file(Line Mode SAS), however some
procedures have no output or send the
output to the log window, or .log file,
• A relatively new improvement to SAS is
ODS(Output Delivery System), improves
the way output is delivered from
procedures.
• ODS still doesn’t deliver “great” output but
it can be useful, as well, it can create .pdf,
.html, .rtf, and many other file types. 24
“GUI’s” for Procedures
• As mentioned earlier there are some
graphical user interfaces for procedures, one
that is very useful is the SAS/SQL GUI.
• The SQL GUI can be found be selecting
“tools” then “Query”.
• Another GUI is for proc import, this is the
import data wizard that you’ve seen.
• SAS/ASSIST is a GUI for some other
procedures.
25
Help on Syntax of Procedures
• If you get stuck and forget the syntax of a
procedure look it up in the “online” help.
• A keyboard short cut to find help on a
procedure is to put the cursor on the
procedure “word”(i.e. proc freq, proc
contents, etc.) in the editor window and hit
F1 and it will bring up the syntax for the
procedure(thanks to Dr. Pereira for this tip!)
26
Help on the Help!
• It’s a long running joke(although not a good
one!) that you need a SAS manual to read a
SAS manual.
• There’s a good description of SAS’s syntax
convention in the SAS OnlineDoc Version 8,
which I didn’t copy because of copyright
reasons!
27