■ SAS – Student Notes
Course: Introduction to Data Analysis Softwares
Module IV – Statistical Analysis System (SAS)
University of Kerala – Four Year Undergraduate Programme
1. Introduction to SAS
SAS (Statistical Analysis System) is a powerful software used for data management, analysis, and reporting. It is
widely applied in research, healthcare, business, and government. In this module, you will learn how to use SAS
Studio to handle datasets, perform descriptive statistics, and create simple visualizations.
2. SAS Studio Environment
When you open SAS Studio, the screen is divided into several parts:
• Editor – Where you type SAS code.
• Log – Shows notes, warnings, and errors.
• Results/Output – Displays results of your code.
• Libraries – Collections of datasets (WORK = temporary, SASHELP = sample data, user-defined libraries).
3. DATA Step Programming
The DATA step is used to create or modify datasets.
data students;
input name $ age marks;
datalines;
John 20 85
Mary 22 90
Ali 21 70
;
run;
Explanation: This creates a dataset called *students* with variables name, age, and marks.
4. PROC Step Programming
PROC steps are procedures used for analysis and reporting.
Example – Print data:
proc print data=students;
run;
Example – Summary statistics:
proc means data=students mean std min max;
var marks;
run;
Example – Frequency table:
proc freq data=students;
tables age;
run;
5. Data Management Techniques
Sorting, filtering, and combining datasets are important tasks.
/* Sort */
proc sort data=students out=sorted;
by age;
run;
/* Subset */
data passed;
set students;
if marks >= 50;
run;
/* Merge */
proc sort data=class; by name; run;
proc sort data=scores; by name; run;
data merged;
merge class scores;
by name;
run;
6. Descriptive Statistics
proc means data=students mean std min max;
var marks;
run;
proc freq data=students;
tables grade;
run;
proc univariate data=students;
var marks;
histogram marks / normal;
run;
7. Visualization with PROC SGPLOT
/* Histogram */
proc sgplot data=students;
histogram marks;
run;
/* Bar chart */
proc sgplot data=students;
vbar age / response=marks stat=mean;
run;
/* Boxplot */
proc sgplot data=students;
vbox marks / category=age;
run;
8. Exporting Results
ods excel file='/home/yourid/report.xlsx';
proc means data=students;
var marks;
run;
ods excel close;
■ By the end of this module, you should be able to import, clean, analyze, and visualize data using SAS Studio.