This action might not be possible to undo. Are you sure you want to continue?

Welcome to Scribd! Start your free trial and access books, documents and more.Find out more

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: proc something <data=dsname options>; <where conditional statements;> <options;> <by varlist;> <label label statement as in a data step;> <format format statement as in a data step;> <run;> <quit;>

3

**Syntax Common to Most Procedures
**

• The “data=“ statement specifies the data set the procedure will use, if the procedure requires an input data set(some don’t). If the “data=“ statement is left out the last data set created is used. • “Where” clause allows subsetting of data. • “by” statement allows the processing of the procedure separately for each level of the “by” variable, you need to sort the input data set by the “by” variable.

4

**Syntax Common to Most Procedures
**

• The “label” and “format” statements work exactly the same as in the data step. The formats and labels are removed from the data set after the procedure is ended. • Some procedures are interactive and start processing when the proc statement is submitted. Others require a “run;” statement at the end of the procedure code to start processing, or start processing by reaching the beginning of another SAS statement.

5

**Syntax Common to Most Procedures
**

• Most procedures will end on their own after all the procedure code is submitted, but for “interactive” procedures, such as: proc gplot, gchart, sql, reg, and some others; a “quit;” statement must be used to end the procedure unless code related to another procedure, data step, SAS option, etc. is reached.

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: proc print <data = yourdataset> <label> <options>; <var varlist;> <id idvars;> <options;> run;

8

Proc Print

• “label” statement tells SAS whether you want the labels or variable names of variables used as column headers. • The “var” statement lets you list the variables in the data set you want printed. • By default observations(rows) in the dataset are identified by the row number, the “id” statement allows you change this to a set of variables(don’t include these variables in the “var” statement unless you want them printed out twice ). 9

**Other Report Writing Procedures
**

• proc printto allows output, and log files to be redirected to a specified text file. • Proc report & tabulate are “fancier” versions of proc print, they can also do some minor calculations.

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 univariate <data=dsname> <options>; <var varlist;> <options;> <run;>

12

Proc Univariate

• If no variables are specified in the “var” option the procedure will run on all the variables in the data set specified. • This procedure outputs a wide variety of statistics and can also create output datasets containing these statistics. • Proc univariate will conduct t-tests, and tests for non-normality(if the normal option is used). • It will also produce histograms, probability plots, …

13

Proc Means

• Basically a scaled down version of proc univariate, does not conduct tests, fewer statistics, etc. • Its advantage over proc univariate is that it processes quicker, and is easier to work with if the aim is to get an output data set that contains statistics of more than one variable. proc univariate does not do this.

14

Proc Freq

• Basically creates frequency, and contingency tables. proc freq <data=dsname> <options>; <table varlist;> <options;> <run;>

15

Proc Freq

• In the table statement if you want to create a contingency table of one or more variables join the variables by an asterisk(*). 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 nonparametric 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
**

• Proc copy – copies SAS datasets, catalogs. • Proc datasets – works on datasets in a library. • Proc compare – compares two datasets. • Proc append – concatenates data sets. • Proc transpose – transposes data(we’ll talk about this later)

20

**Categories of Other Procedures
**

• SAS/STAT – statistical procedures, learn about these for the most part in a statistics classes. • SAS/ACCESS – procedures for importing data from other sources. • SAS/OR – procedures related to operations research(proc netwflow for network problems, etc.)

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 normalprobability 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

- Sas Procedures
- Learn SAS Programming SAS Video Tutorials SAS eBooks SAS Tutorials SAS Tips and Techniques Base SAS and Advanced SAS Certification CDISC SDTM
- LEARN SAS Within 7 Weeks Part6 Producing Graphics and Using SAS Analyst
- LEARN SAS Within 7 Weeks Part5 Procedures to Summarize Data
- LEARN SAS Within 7 Weeks Part4 More on Manipulating Data
- LEARN SAS Within 7 Weeks Part3 Introduction to SAS SET MERGE and Multiple Operations
- LEARN SAS Within 7 Weeks Part2 Introduction to SAS the Data Step
- LEARN SAS Within 7 Weeks Part1
- Introduction to Sas Procedures 3
- Introduction to Sas Procedures 2
- Introduction to Sas Procedures 1
- SAS Interview Questions and Answers and Model RESUMES

- LEARN SAS within 7 weeks
- 36141-960
- The Importance of Software Testing
- data cleansing example
- Histogram Tutorial
- 1007.1268
- Chapter 5
- DW+&+DM
- Data Cleaning
- ch17
- Comparatie What if Si Sensibilitate
- 10.1.1.120.2734
- Software Metrics
- tr50
- Image Inpainting System Model Based on Evaluation
- G4 Data Mining 310
- Lecture 12
- DIRA
- ACTWEE
- IDEF_V4
- 01006668
- Random Testing
- Data Mining
- An Efficient Approach for Clustering High Dimensional Data
- Software Metrics-3.ppt
- integrating testing with reliability
- F0256101511 Grey Relational Analysis(GRA)
- Multivariate All
- R_lcc
- Software Testing

Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

We've moved you to where you read on your other device.

Get the full title to continue

Get the full title to continue listening from where you left off, or restart the preview.

scribd