SAS Notes 1
SAS Notes 1
SAS Notes 1
Overiew of SAS
Base/SAS is the core foundation for
a variety of data management and
analytical software components
offered by SAS.
1.Overiew of SAS
Base/SAS provides the essential tools for the
basic data driven tasks that are commonly
performed by a programmer.
Data access
Management
Analysis
Presentation.
1.Overiew of SAS
1.Overiew of SAS
SAS programming language is used to
Access data from many sources
Manage your data
Analyse the data and present it as meaningful
information in a report that can be delivered to
any platform , in any format needed.
Data access management analysis
and presentation
1.Overiew of SAS
Accessing data:
SAS can access data
That is stored almost anywhere whether it is
in a file on the system , or the data that is
stored on a remote server or in another
database system.
That is almost in any format including the raw
data sets, SAS data sets and files created by
other software.
1.Overiew of SAS
Types of files that can be accessed:
Relational databases: DB2, oracle, teradata,
MS SQL server.
Non-relational database: ADABAS, PC file
formats, System 2000 software.
Enterprise resource planning (ERP) systems:
Baan, SAP BW.
1.Overiew of SAS
Managing data:
SAS programming language is used to
manipulate the data .We can use it for
formatting the data , creating the variables ,
use operators and functions to evaluate,
create and recode data values, subset the
data ,perform conditional processing merge
data sources, create , retrieve and update
database information.
1.Overiew of SAS
Analyzing data and presenting
information:
Once the data is proper ,SAS is used to
analyze data and produce reports. SAS
output can range from a simple listing of a
dataset to customized reports of complex
relationships.
1.Overiew of SAS
SAS is a powerful data analysis tool. We can
produce tables , frequency counts and cross
tabulation tables, create a variety of charts
and plots, compute a variety of descriptive
statistics , including mean , sum , variance
etc, compute correlations and other measures
of association, as well as multi-way cross
tabulations and inferential statistics.
1.Overiew of SAS
Presentation:
SAS has limitless number of visually appealing output formats ,
such as,
An array of markup languages including HTML4 and XML.
Output that is formatted for a high resolution printer , such as
post script , PDF, and PCL files
RTF
Color graphs tht can be made interactive using Active X
controls or Java applets.
these can be later sent to a variety of locations and platfoms.
2.Explore SAS workspace
When SAS is started ,five main windows
open.
The explorer window
The results window
The log window
The editor window
The output window.
2.Explore SAS workspace
THE EXPLORER WINDOW:
This is to view and manage the SAS files and
create shortcuts to files that are not formatted
by SAS. This window is used to
Create new SAS libraries and SAS files.
Open any SAS file.
Perform most file management tasks such as
moving, copying, and deleting files.
Create shortcuts.
2.Explore SAS workspace
THE EDITOR WINDOW:
This window is used to enter, edit, and submit SAS
programs. This provides useful editor features like
Color coding and syntax checking of SAS
language
Expandable and collapsible sections
Recordable macros
Support for keyboard shortcuts
Multilevel undo and redo.
2.Explore SAS workspace
THE LOG WINDOW:
This displays the messages about the SAS
session and any SAS programs that are
submitted.
2.Explore SAS workspace
THE OUTPUT WINDOW:
This displays the output from SAS programs
that are submitted.
NOTE: Not all SAS programs create output in
the output window. Some programs open
interactive windows. Others produce
messages in the log, and few others
produce in the results viewer window.
2.Explore SAS workspace
THE RESULTS VIEWER WINDOW:
This helps to navigate and manage the output
from SAS programs that are submitted.
2.Explore SAS workspace
Along with all these SAs provides a set of
ready-to-use solutions , applications and
tools. These are available in the tools
menu.
SAS also has online helpwhich is available
from the help menu.
3.Work with SAS data sets
Before any work is done , the data has to be in a
special form called a SAS data set.
SAS data set (or a table) is a file containing
descriptor information and related data values.
This is organized as a table of rows
(observations) and columns (variables) that can
SAS process. Some SAS datasets also contain
an index, which enables SAS to locate records in
the data set.
3.Work with SAS data sets
All SAS files are stored in a SAS library. This
is a collection of files such as SAS datasets
and catalogs.
To access a library , a name is assigned
(libref). These are the shortcuts that are
used to identify libraries during a SAS
session.
3.Work with SAS data sets
View SAS files in a library:
Go to explorer window
Scroll down to see several types of files in the library (sas data
set/view/catalog/MDDB)
3.Work with SAS data sets
Assign a library:
When a library is defined , location of the
SAS files to SAS is indicated. Once the
library is defined d, SAS files can be
managed within it.
3.Work with SAS data sets
On the toolbar , click new library icon
Drag the data set from the right pane and drop it into the desired
library
Click the library to find the data set in the library. Right click and
select rename and type the new name.
3.Work with SAS data sets
There are many ways to get data into SAS data set.
Enter data directly into SAS using view table window
Read raw data into SAS using import wizard or proc
statements
Read and modify existing data sets using SAS programming
statements
Convert other software data files into SAS data set by
SAS/Access
Read other software data directly using SAS/Access
3.Work with SAS data sets
Open a SAS data set:
Select the library from the explorer window
Click ok.
4.Create and run SAS programs
Modify the program:
We can add options to the programs to
Remove the date from the top of each page.
Replace the default ‘the SAS system title’.
Use the column label rather than the
column name in the output.
Remove the obs column.
4.Create and run SAS programs
To remove date from the top of each page use
NODATE system option and paste it at the top of
the program.
options nodate;
To replace the default title , use TITLE statement.
title “ life is beautiful”;
To remove obs column and use column labels,
use options on PROC PRINT statement.
Proc print data=xyz label noobs;
4.Create and run SAS programs
View and Save results:
HTML results can be created and saved in HTML files.
In the results window, scroll the HTML results.
With results viewer window active, select file > save as. In the
filename box, type the name and click save.
The results window now shows a new folder for the results of
the program .double click on the folder to view the output.
4.Create and run SAS
Save a SAS program and set up a favorite folder:
programs
When SAS programs are saved , we can store them in a folder that is easy to
access from the explorer window.
With the editor window active, select file > save as.
This opens to default folder on the system . In filename box , type the name
and click save. The file is saved with a .sas extension, indicating that it is a
SAS program.
Right click in the favorite folders window and select new favorite folder.
In the new favorite folder window type , type folder name in the name box.
Click browse. The select window opens to the same default location where the
program was saved. Click ok.