This document provides an overview of SAS products and the basic structure of SAS programs. It discusses that SAS programs typically have data and procedure steps, where the data step prepares data and procedure steps analyze the data. The document also outlines how to access files from external sources using FTP or %include statements and write comments in SAS programs.
2. Tyoes off SAS
Overview of SAS Products
Basic Structure of SAS
Structure of SAS programs
FTP Access
Reading SAS programs from external files
3. Overview of SAS Products
Base SAS - data management and basic
procedures • SAS/STAT - statistical analysis •
SAS/GRAPH - presentation quality graphics •
SAS/OR - Operations research • SAS/ETS -
Econometrics and Time Series Analysis • SAS/IML -
interactive matrix language • SAS/AF - applications
facility (menus and interfaces) • SAS/QC - quality
control There are other specialized products for
spreadsheets, access to databases, connectivity
between different machines running SAS
4. Basic Structure of SAS
There are two main components to most SAS
programs - the data step(s) and the procedure
step(s). The data step reads data from external
sources, manipulates and combines it with other
data set and prints reports. The data step is used
to prepare your data for use by one of the
procedures (often called “procs”). SAS is very
lenient about the format of its input - statements
can be broken up across lines, multiple statements
can appear on a single line, and blank spaces and
lines can be added to make the program more
readable.
5. Structure of SAS programs
Lines beginning with an asterisk (*) are treated
as comments. Alternatively you can enclose
comments between /* and */. • You can combine
as many data and proc steps in whatever order
you want. • Data steps begin with the word data
and procedure steps begin with the word proc. •
The run; command signals to SAS that the
previous commands can be executed. •
Terminate an interactive SAS job with the endsas;
statement. • There are global options (like
linesize and pagesize) as well as options specific
to datasets and procedures.
6. FTP Access
SAS provides the ability to read data directly from
an FTP server, without the need to create a local
copy of the file, through the ftp keyword of the
filename statement. Suppose there is a data file
called user.dat in the directory public on an ftp
server named ftp.myserver.com. If your user name
is joe and your password is secret, the following
statement will establish a fileref for reading the
data: filename myftp ftp ’user.dat’ cd=’/public’
user=’joe’ pass=’secret’ host=’ftp.myserver.com’;
7. Reading SAS programs from external files
The infile statement can be used to read data
which is stored in a file separate from your SAS
program. When you want SAS to read your program
from an external file you can use the %include
statement, followed by a filename or fileref. After
SAS processes a %include statement, it continues to
read data from its original source (input file,
keyboard or display manager