Using SAS 9.3: An Introduction
LSU Economics Department
January 27, 2012
Access to SAS
• SAS 9.2 on VLAB
• In Econ Dept lab (for Econ Grad students)
• Department of Experimental Statistics
SAS Resources & Workshops
• http://www.bus.lsu.edu/hill/computing/sas/sas.htm
• http://www.bus.lsu.edu/hill/computing/sas/sasworkshop.htm
What is SAS
• SAS describes itself as “…the leader in
business intelligence and predictive analytics
software.” Its users include 96 of the top 100
companies on the 2006 Fortune Global 500
List.
• More than 43,000 business, government and
university sites rely on SAS.
• Organizations in 113 different countries use
SAS.
SAS in Job Market
• Job Openings for Economists, Full Time
nonacademic listings. Search PDF files for
“SAS”.
– November 2010
– February 2011
What is SAS
• SAS is an elephant.
• Stata, EViews, MATLAB, etc. are fleas.
• SAS is not nimble. It does not quickly add new
methods. It does not release updates weekly.
• SAS has superior numerical optimization
algorithms.
• SAS matrix programming competitive to
MATLAB and Gauss, far superior to MATA.
What is SAS
• SAS can process huge amounts of data.
• Many data sites provide SAS input statements
for data files.
• CPS, 2008 survey: 421911 observations and
1023 variables in less than 40 seconds CPU
time on my laptop
• NBER data: Many downloads in SAS format.
SAS Documentation
•
•
•
•
SAS Product Documentation
Code samples
UCLA: Documentation and Movies
Hill and Campbell, Using SAS for Econometrics,
John Wiley and Sons, forthcoming
• Data Examples from Principles of
Econometrics, 4th Edition
SAS 9.3
• Starting SAS 9.3
What’s New
Changing Preferences
Old fashioned output & new graphics
Overview of Screens
 Enhanced Editor
 SAS Log
 SAS Output
 Explorer
 Results
 Default path
SAS Programs
/*--------------------------------------------*/
/* Example 1: Read embedded data */
/*---------------------------------------------*/
data htwt;
input name $ sex $ age height weight;
sum = height + weight;
diff = height - weight;
prod = height * weight;
div = height / weight;
power = age**2;
/* next statements define data lines */
datalines;
alfred M 14 69 112
alice F 13 56 84
barbara F 14 62 102
henry M 15 67 135
john
M 16 70 165
sally F 16 63 120
;
run;
/* print data */
proc print data=htwt;
title 'Height-Weight Data';
run;
* name data set;
* specify variables;
* sum;
* difference;
* product;
* division;
* age squared;
Reading data
Embedded in file
External ASCII
Existing SAS data set
Import Wizard for Excel, SPSS,
Stata and other data formats
StatTransfer (Econ grad lab)
Summary Statistics
•
•
•
•
Summary Statistics: PROC MEANS
Detailed Statistics: PROC UNIVARIATE
Basic Regression
HELP