SlideShare a Scribd company logo
Statistical Analysis Systems
Workshop
Bilal Mazhar
Introduction
SAS stands for Statistical Analysis Software. It was created in the year 1960 by the SAS Institute.
From 1st January 1960, SAS was used in
• Data management
• Business intelligence
• Predictive Analysis
• Descriptive Analysis
• Prescriptive Analysis
Why we use SAS
SAS is basically worked on large datasets. With the help of SAS software you can perform various
operations on the data like
• Data Management
• Statistical Analysis
• Report formation with perfect graphics
• Business Planning
• Operations Research and project Management
• Quality Improvement
• Application Development
• Data extraction
• Data transformation
• Data updating and modification
SAS Component & their Usage
Sr. No SAS Component & their Usage
1
Base SAS
It is a core component which contains data management facility and a programming
language for data analysis. It is also the most widely used.
2 SAS/GRAPH
Create graphs, presentations for better understanding and showcasing the result in a
proper format.
3 SAS/STAT
Perform Statistical analysis with the variance analysis, regression, multivariate analysis,
survival analysis, and psychometric analysis, mixed model analysis.
4 SAS/OR
Operations research.
5 SAS/ETS
Econometrics and Time Series Analysis.
6 SAS/Enterprise Miner
Data mining.
Installation
&
Up and running
https://www.virtualbox.org/wiki/Downloads
https://www.virtualbox.org/wiki/Downloads
https://www.virtualbox.org/wiki/Downloads
The following screen appears when the above-stated link in clicked.
When we enter this http://localhost:10080/, the following window opens up.
The SAS studio window looks like the following screen.
SAS Windows
Code Auto Completion
Executing SAS Program
Result Window
Server Files and Folders
Task and Utilities
Basic Syntax
SAS Program Structure
SAS Variable Names
• It can be maximum 32 characters long.
• It can not include blanks.
• It must start with the letters A through Z (not case sensitive) or an underscore (_).
• Can include numbers but not as the first character.
• Variable names are case insensitive.
SAS Data Set
The DATA statement marks the creation of a new SAS data set. The rules for DATA set creation are as below.
• A single word after the DATA statement indicates a temporary data set name. Which means the data set gets
erased at the end of the session.
• The data set name can be prefixed with a library name which makes it a permanent data set. Which means the
data set persists after the session is over.
• If the SAS data set name is omitted then SAS creates a temporary data set with a name generated by SAS like -
DATA1, DATA2 etc.
The SAS programs, data files and the results of the programs are saved with various extensions in windows.
• .sas − It represents the SAS code file which can be edited using the SAS Editor or any text editor.
• .log − It represents the SAS Log File it contains information such as errors, warnings, and data set details for a
submitted SAS program.
• .mht / *.html −It represents the SAS Results file.
• .sas7bdat −It represents SAS Data File which contains a SAS data set including variable names, labels, and the results
of calculations.
SAS File Extensions
Comments in SAS
Following is a multiline comment example −
/*message*/ type comment
A comment in the form of /*message*/ is used more frequently and it can not be nested. But it can span multiple
lines and can be of any length. Following is a single line comment example
Example
PROC Step
This step involves invoking a SAS built-in procedure to analyze the data.
Example
The below example shows using the MEANS procedure to print the mean values of the numeric variables in the data
set.
Declaring String Variables
String Functions
SUBSTRN
This function extracts a substring using the start and end positions. In case of no end position is mentioned it extracts all
the characters till end of the string.
Arrays
Examples of Array Declaration
Accessing Array Values
Mathematical Functions
Input Methods
The input methods are used to read the raw data. The raw data may be from an external source or from in
stream datalines. The input statement creates a variable with the name that you assign to each field. So you
have to create a variable in the Input Statement. The same variable will be shown in the output of SAS
Dataset. Below are different input methods available in SAS.
• List Input Method
• Named Input Method
• Column Input Method
• Formatted Input Method
List Input Method
Named Input Method
Column Input Method
Formatted Input Method
Read Raw Data
SAS can read data from various sources which includes many file formats. The file formats used in SAS environment is
discussed below.
• ASCII(Text) Data Set
• Delimited Data
• Excel Data
• Hierarchical Data
Reading ASCII(Text) Data Set
Reading Delimited Data
Reading Excel Data
Write Data Sets
Similar to reading datasets, SAS can write datasets in different formats. It can write data from SAS files to normal text
file. These files can be read by other software programs. SAS uses PROC EXPORT to write data sets.
PROC EXPORT
It is a SAS inbuilt procedure used to export the SAS data sets for writing the data into files of different formats.
Syntax
The basic syntax for writing the procedure in SAS is −
Following is the description of the parameters used −
•SAS data-set is the data set name which is being exported. SAS can share the data sets from its environment with
other applications by creating files which can be read by different operating systems. It uses the inbuilt EXPORT
function to out the data set files in a variety of formats. In this chapter we will see the writing of SAS data sets using
proc export along with the options dlm and dbms.
•SAS data-set-options is used to specify a subset of columns to be exported.
•filename is the name of the file to which the data is written into.
•identifier is used to mention the delimiter that will be written into the file.
•LABEL option is used to mention the name of the variables written to the file.
On executing the above code we can see the output as a text file and right click on it to see its content as shown below.
In order to write a comma delimited file we can use the dlm option with a value "csv". The following code writes the file
car_data.csv.
Writing a CSV file
On executing the above code we get the below output.
Concatenate Data Sets
Multiple SAS data sets can be concatenated to give a single data set using the SET statement. The total number of
observations in the concatenated data set is the sum of the number of observations in the original data sets. The order of
observations is sequential. All observations from the first data set are followed by all observations from the second data
set, and so on.
Ideally all the combining data sets have same variables, but in case they have different number of variables, then in the
result all the variables appear, with missing values for the smaller data set.
Syntax
The basic syntax for SET statement in SAS is −
Example
SAS offers extensive support to most of the popular relational databases by using SQL queries inside SAS programs. Most
of the ANSI SQL syntax is supported. The procedure PROC SQL is used to process the SQL statements. This procedure can
not only give back the result of an SQL query, it can also create SAS tables & variables. The example of all these scenarios
is described below.
Syntax
The basic syntax for using PROC SQL in SAS is −
SQL Create Operation
Using SQL we can create new data set form raw data. In the below example, first we declare a data set named TEMP
containing the raw data. Then we write a SQL query to create a table from the variables of this data set.
When the above code is executed we get the following result −
SQL Read Operation
The Read operation in SQL involves writing SQL SELECT queries to read the data from the tables. In The below program
queries the SAS data set named CARS available in the library SASHELP. The query fetches some of the columns of the data
set.
SQL SELECT with WHERE Clause
The below program queries the CARS data set with a where clause. In the result we get only the observation which have
make as 'Audi' and type as 'Sports'.
SQL UPDATE Operation
We can update the SAS table using the SQL Update statement. Below we first create a new table named EMPLOYEES2
and then update it using the SQL UPDATE statement.
SQL DELETE Operation
The delete operation in SQL involves removing certain values from the table using the SQL DELETE statement. We continue
to use the data from the above example and delete the rows from the table in which the salary of the employees is greater
than 900.
SAS – ODS
Output delivery system
The output from a SAS program can be converted to more user friendly forms like .html or PDF. This is done by using
the ODS statement available in SAS. ODS stands for output delivery system. It is mostly used to format the output
data of a SAS program to nice reports which are good to look at and understand. That also helps sharing the output
with other platforms and soft wares. It can also combine the results from multiple PROC statements in one single
file.
Syntax
The basic syntax for using the ODS statement in SAS is −
Following is the description of the parameters used −
•PATH represents the statement used in case of HTML output.
In other types of output we include the path in the filename.
•Style represents one of the in-built styles available in the SAS
environment.
Creating HTML Output
We create HTML output using the ODS HTML statement.In the below example we create a html file in our desired path.
We apply a style available in the styles library. We can see the output file in the mentioned path and we can download it
to save in an environment different from the SAS environment. Please note that we have two proc SQL statements and
both their output is captured into a single file.
When the above code is executed we get the following result −
Creating PDF Output
In the below example we create a PDF file in our desired path. We apply a style available in the styles library. We can see
the output file in the mentioned path and we can download it to save in an environment different from the SAS
environment. Please note that we have two proc SQL statements and both their output is captured into a single file.
When the above code is executed we get the following result −
Creating TRF(Word) Output
In the below example we create a RTF file in our desired path. We apply a style available in the styles library. We can see the
output file in the mentioned path and we can download it to save in an environment different from the SAS environment.
Please note that we have two proc SQL statements and both their output is captured into a single file.
When the above code is executed we get the following result −
SAS Data Representation
A Histogram is graphical display of data using bars of different heights. It groups the various numbers in
the data set into many ranges. It also represents the estimation of the probability of distribution of a
continuous variable. In SAS the PROC UNIVARIATE is used to create histograms with the below options.
Syntax
The basic syntax to create a histogram in SAS is −
Following is the description of parameters used −
•DATASET is the name of the dataset used.
•variables are the values used to plot the histogram.
Example
In the below example, we consider the minimum and maximum values of the variable horsepower and take a range of
50. So the values form a group in steps of 50.
Histogram with Curve Fitting
We can fit some distribution curves into the histogram using additional options.
Example
In the below example we fit a distribution curve with mean and standard deviation values mentioned as EST. This option
uses and estimate of the parameters.
Simple Bar chart
A simple bar chart is a bar chart in which a variable from the dataset is represented as bars.
Example
The below script will create a bar-chart representing the length of cars as bars.
Stacked Bar chart
A stacked bar chart is a bar chart in which a variable from the dataset is calculated with respect to another variable.
Example
The below script will create a stacked bar-chart where the length of the cars are calculated for each car type. We use the
group option to specify the second variable.
Clustered Bar chart
The clustered bar chart is created to show how the values of a variable are spread across a culture.
Example
The below script will create a clustered bar-chart where the length of the cars is clustered around the car type.So we see two
adjacent bars at length 191, one for the car type 'Sedan' and another for the car type 'Wagon'.
Simple Pie Chart
In this pie chart we take a single variable form the dataset. The pie chart is created with value of the slices representing the
fraction of the count of the variable with respect to the total value of the variable.
Example
In the below example each slice represents the fraction of the type of car from the total number of cars.
Pie Chart with Data Labels
In this pie chart we represent both the fractional value as well as the percentage value for each slice. We also change the
location of the label to be inside the chart. The style of appearance of the chart is modified by using the DATASKIN option. It
uses one of the inbuilt styles, available in the SAS environment.
Grouped Pie Chart
In this pie chart the value of the variable presented in the graph is grouped with respect to another variable of the same
data set. Each group becomes one circle and the chart has as many concentric circles as the number of groups available.
Example
In the below example we group the chart with respect to the variable named "Make". As there are two values available
("Audi" and "BMW") so we get two concentric circles each representing slices of car types in its own make.
SAS Basic Statistical Procedure
The arithmetic mean is the value obtained by summing value of numeric variables and then dividing the sum with the
number of variables. It is also called Average. In SAS arithmetic mean is calculated using PROC MEANS. Using this SAS
procedure we can find the mean of all variables or some variables of a dataset. We can also form groups and find mean
of variables of values specific to that group
Syntax
The basic syntax for calculating arithmetic mean in SAS is −
Following is the description of parameters used −
•DATASET − is the name of the dataset used.
•Variables − are the name of the variable from the dataset.
Mean of a Dataset
The mean of each of the numeric variable in a dataset is calculated by using the PROC by supplying only the dataset name
without any variables.
Example
In the below example we find the mean of all the numeric variables in the SAS dataset named CARS. We specify the
maximum digits after decimal place to be 2 and also find the sum of those variables.
Mean of Select Variables
We can get the mean of some of the variables by supplying their names in the var option.
Example
In the below we calculate the mean of three variables.
Mean by Class
We can find the mean of the numeric variables by organizing them to groups by using some other variables.
Example
In the example below we find the mean of the variable horsepower for each type under each make of the car.
Standard deviation (SD) is a measure of how varied is the data in a data set. Mathematically it measures how distant
or close are each value to the mean value of a data set. A standard deviation value close to 0 indicates that the data
points tend to be very close to the mean of the data set and a high standard deviation indicates that the data points
are spread out over a wider range of values
In SAS the SD values is measured using PROC MEAN as well as PROC SURVEYMEANS.
Using PROC MEANS
To measure the SD using proc means we choose the STD option in the PROC step. It brings out the SD values for each
numeric variable present in the data set.
Syntax
The basic syntax for calculating standard deviation in SAS is −
Following is the description of the parameters used −
•Dataset − is the name of the dataset.
Example
In the below example we create the data set CARS1 form the CARS data set in the SASHELP library. We choose the STD
option with the PROC means step.
A frequency distribution is a table showing the frequency of the data points in a data set. Each entry in the table contains
the frequency or count of the occurrences of values within a particular group or interval, and in this way, the table
summarizes the distribution of values in the sample.
SAS provides a procedure called PROC FREQ to calculate the frequency distribution of data points in a data set.
Syntax
The basic syntax for calculating frequency distribution in SAS is −
Following is the description of the parameters used −
•Dataset is the name of the dataset.
•Variables_1 is the variable names of the dataset whose frequency distribution needs to be calculated.
•Variables_2 is the variables which categorised the frequency distribution result.
Single Variable Frequency Distribution
We can determine the frequency distribution of a single variable by using PROC FREQ. In this case the result will show the
frequency of each value of the variable. The result also shows the percentage distribution, cumulative frequency and
cumulative percentage.
Example
In the below example we find the frequency distribution of the variable horsepower for the dataset named CARS1 which is
created form the library SASHELP.CARS. We can see the result divided into two categories of results. One for each make of
the car.
Multiple Variable Frequency Distribution
We can find the frequency distributions for multiple variables which groups them into all possible combinations.
Example
In the below example we calculate the frequency distribution for the make of a car for grouped by car type and also the
frequency distribution of each type of car grouped by each make.
Cross tabulation involves producing cross tables also called contingent tables using all possible combinations of two or
more variables. In SAS it is created using PROC FREQ along with the TABLES option. For example - if we need the
frequency of each model for each make in each car type category, then we need to use the TABLES option of PROC FREQ.
Syntax
The basic syntax for applying cross tabulation in SAS is −
Following is the description of the parameters used −
•Dataset is the name of the dataset.
•Variable_1 and Variable_2 are the variable names of the dataset whose frequency distribution needs to be calculated.
Example
Consider the case of finding how many car types are available under each car brand from the dataset cars1 which is
created form SASHELP.CARS as shown below. In this case we need the individual frequency values as well as the sum of
the frequency values across the makes and across the types. We can observer that the result shows values across the
rows and the columns.
The T-tests are performed to compute the confidence limits for one sample or two independent samples by comparing
their means and mean differences. The SAS procedure named PROC TTEST is used to carry out t tests on a single variable
and pair of variables.
Syntax
The basic syntax for applying PROC TTEST in SAS is −
Following is the description of the parameters used −
•Dataset is the name of the dataset.
•Variable_1 and Variable_2 are the variable names of the dataset used in t test.
Example
Below we see one sample t test in which find the t test estimation for the variable horsepower with 95 percent confidence
limits.
Correlation analysis deals with relationships among variables. The correlation coefficient is a measure of linear
association between two variables.Values of the correlation coefficient are always between -1 and +1. SAS provides the
procedure PROC CORR to find the correlation coefficients between a pair of variables in a dataset.
Syntax
The basic syntax for applying PROC CORR in SAS is −
Following is the description of the parameters used −
•Dataset is the name of the dataset.
•Options is the additional option with procedure like plotting a matrix etc.
•Variable is the variable name of the dataset used in finding the correlation.
Example
Correlation coefficients between a pair of variables available in a dataset can be obtained by use their names in the VAR
statement.In the below example we use the dataset CARS1 and get the result showing the correlation coefficients
between horsepower and weight.
Correlation Between All Variables
Correlation coefficients between all the variables available in a dataset can be obtained by simply applying the procedure
with the dataset name.
Example
In the below example we use the dataset CARS1 and get the result showing the correlation coefficients between each pair
of the variables.
Linear Regression is used to identify the relationship between a dependent variable and one or more independent
variables. A model of the relationship is proposed, and estimates of the parameter values are used to develop an
estimated regression equation.
Various tests are then used to determine if the model is satisfactory. If it is then, the estimated regression equation can
be used to predict the value of the dependent variable given values for the independent variables. In SAS the procedure
PROC REG is used to find the linear regression model between two variables.
Syntax
The basic syntax for applying PROC REG in SAS is −
Following is the description of the parameters used −
•Dataset is the name of the dataset.
•variable_1 and variable_2 are the variable names of the dataset used in finding the correlation.
Example
The below example shows the process to find the correlation between the two variables horsepower and weight of a car
by using PROC REG. In the result we see the intercept values which can be used to form the regression equation.
Case study
SAS - Training
SAS - Training
SAS - Training
SAS - Training

More Related Content

What's hot

SAS Programming Notes
SAS Programming NotesSAS Programming Notes
SAS Programming Notes
Gnana Murthy A
 
SAS Mainframe -Program-Tips
SAS Mainframe -Program-TipsSAS Mainframe -Program-Tips
SAS Mainframe -Program-Tips
Srinimf-Slides
 
Base SAS Statistics Procedures
Base SAS Statistics ProceduresBase SAS Statistics Procedures
Base SAS Statistics Procedures
guest2160992
 
Proc SQL in SAS Enterprise Guide 4.3
Proc SQL in SAS Enterprise Guide 4.3Proc SQL in SAS Enterprise Guide 4.3
Proc SQL in SAS Enterprise Guide 4.3
Mark Tabladillo
 
Introduction to SAS
Introduction to SASIntroduction to SAS
Introduction to SAS
Imam Jaffer
 
Introduction to-sas-1211594349119006-8
Introduction to-sas-1211594349119006-8Introduction to-sas-1211594349119006-8
Introduction to-sas-1211594349119006-8
thotakoti
 
Basics of SAS
Basics of SASBasics of SAS
Basics of SAS
Taddesse Kassahun
 
SAS cheat sheet
SAS cheat sheetSAS cheat sheet
SAS cheat sheet
Ali Ajouz
 
Introduction to sas
Introduction to sasIntroduction to sas
Introduction to sas
Ajay Ohri
 
Understanding SAS Data Step Processing
Understanding SAS Data Step ProcessingUnderstanding SAS Data Step Processing
Understanding SAS Data Step Processing
guest2160992
 
Base sas interview questions
Base sas interview questionsBase sas interview questions
Base sas interview questions
Dr P Deepak
 
Base SAS Full Sample Paper
Base SAS Full Sample Paper Base SAS Full Sample Paper
Base SAS Full Sample Paper
Jimmy Rana
 
SAS Macros
SAS MacrosSAS Macros
SAS Macros
guest2160992
 
Sas training in hyderabad
Sas training in hyderabadSas training in hyderabad
Sas training in hyderabad
Kelly Technologies
 
Sas Statistical Analysis System
Sas Statistical Analysis SystemSas Statistical Analysis System
Sas Statistical Analysis System
Sushil kasar
 
Sas Macro Examples
Sas Macro ExamplesSas Macro Examples
Sas Macro Examples
SASTechies
 
SAS basics Step by step learning
SAS basics Step by step learningSAS basics Step by step learning
SAS basics Step by step learning
Venkata Reddy Konasani
 
SAS Online Training by Real Time Working Professionals in USA,UK,India,Middle...
SAS Online Training by Real Time Working Professionals in USA,UK,India,Middle...SAS Online Training by Real Time Working Professionals in USA,UK,India,Middle...
SAS Online Training by Real Time Working Professionals in USA,UK,India,Middle...
Oracle Apps R12, Financials,SCM,PA,HRMSCorporate Training
 
Sas Enterprise Guide A Revolutionary Tool
Sas Enterprise Guide A Revolutionary ToolSas Enterprise Guide A Revolutionary Tool
Sas Enterprise Guide A Revolutionary Tool
sysseminar
 
10863-2016
10863-201610863-2016
10863-2016
Hong Zhang
 

What's hot (20)

SAS Programming Notes
SAS Programming NotesSAS Programming Notes
SAS Programming Notes
 
SAS Mainframe -Program-Tips
SAS Mainframe -Program-TipsSAS Mainframe -Program-Tips
SAS Mainframe -Program-Tips
 
Base SAS Statistics Procedures
Base SAS Statistics ProceduresBase SAS Statistics Procedures
Base SAS Statistics Procedures
 
Proc SQL in SAS Enterprise Guide 4.3
Proc SQL in SAS Enterprise Guide 4.3Proc SQL in SAS Enterprise Guide 4.3
Proc SQL in SAS Enterprise Guide 4.3
 
Introduction to SAS
Introduction to SASIntroduction to SAS
Introduction to SAS
 
Introduction to-sas-1211594349119006-8
Introduction to-sas-1211594349119006-8Introduction to-sas-1211594349119006-8
Introduction to-sas-1211594349119006-8
 
Basics of SAS
Basics of SASBasics of SAS
Basics of SAS
 
SAS cheat sheet
SAS cheat sheetSAS cheat sheet
SAS cheat sheet
 
Introduction to sas
Introduction to sasIntroduction to sas
Introduction to sas
 
Understanding SAS Data Step Processing
Understanding SAS Data Step ProcessingUnderstanding SAS Data Step Processing
Understanding SAS Data Step Processing
 
Base sas interview questions
Base sas interview questionsBase sas interview questions
Base sas interview questions
 
Base SAS Full Sample Paper
Base SAS Full Sample Paper Base SAS Full Sample Paper
Base SAS Full Sample Paper
 
SAS Macros
SAS MacrosSAS Macros
SAS Macros
 
Sas training in hyderabad
Sas training in hyderabadSas training in hyderabad
Sas training in hyderabad
 
Sas Statistical Analysis System
Sas Statistical Analysis SystemSas Statistical Analysis System
Sas Statistical Analysis System
 
Sas Macro Examples
Sas Macro ExamplesSas Macro Examples
Sas Macro Examples
 
SAS basics Step by step learning
SAS basics Step by step learningSAS basics Step by step learning
SAS basics Step by step learning
 
SAS Online Training by Real Time Working Professionals in USA,UK,India,Middle...
SAS Online Training by Real Time Working Professionals in USA,UK,India,Middle...SAS Online Training by Real Time Working Professionals in USA,UK,India,Middle...
SAS Online Training by Real Time Working Professionals in USA,UK,India,Middle...
 
Sas Enterprise Guide A Revolutionary Tool
Sas Enterprise Guide A Revolutionary ToolSas Enterprise Guide A Revolutionary Tool
Sas Enterprise Guide A Revolutionary Tool
 
10863-2016
10863-201610863-2016
10863-2016
 

Similar to SAS - Training

I need help with Applied Statistics and the SAS Programming Language.pdf
I need help with Applied Statistics and the SAS Programming Language.pdfI need help with Applied Statistics and the SAS Programming Language.pdf
I need help with Applied Statistics and the SAS Programming Language.pdf
Madansilks
 
BAS 150 Lesson 3 Lecture
BAS 150 Lesson 3 LectureBAS 150 Lesson 3 Lecture
BAS 150 Lesson 3 Lecture
Wake Tech BAS
 
Prog1 chap1 and chap 2
Prog1 chap1 and chap 2Prog1 chap1 and chap 2
Prog1 chap1 and chap 2
rowensCap
 
Sas summary guide
Sas summary guideSas summary guide
Sas summary guide
Ashish K Sharma
 
8323 Stats - Lesson 1 - 03 Introduction To Sas 2008
8323 Stats - Lesson 1 - 03 Introduction To Sas 20088323 Stats - Lesson 1 - 03 Introduction To Sas 2008
8323 Stats - Lesson 1 - 03 Introduction To Sas 2008
untellectualism
 
Sas
Sas Sas
Readme
ReadmeReadme
Readme
Tooktun Love
 
Top 140+ Advanced SAS Interview Questions and Answers.pdf
Top 140+ Advanced SAS Interview Questions and Answers.pdfTop 140+ Advanced SAS Interview Questions and Answers.pdf
Top 140+ Advanced SAS Interview Questions and Answers.pdf
Datacademy.ai
 
Mysql
MysqlMysql
Mysql
Rathan Raj
 
Analytics with SAS
Analytics with SASAnalytics with SAS
Analytics with SAS
Edureka!
 
SAS Commands
SAS CommandsSAS Commands
SAS Commands
Suvojyoti Chowdhury
 
Sas-training-in-mumbai
Sas-training-in-mumbaiSas-training-in-mumbai
Sas-training-in-mumbai
Unmesh Baile
 
Sas Talk To R Users Group
Sas Talk To R Users GroupSas Talk To R Users Group
Sas Talk To R Users Group
georgette1200
 
SAS_Overview_Short.pptx
SAS_Overview_Short.pptxSAS_Overview_Short.pptx
SAS_Overview_Short.pptx
Sri harshadeep Chilukuri
 
BAS 150 Lesson 4 Lecture
BAS 150 Lesson 4 LectureBAS 150 Lesson 4 Lecture
BAS 150 Lesson 4 Lecture
Wake Tech BAS
 
Sample Questions The following sample questions are not in.docx
Sample Questions The following sample questions are not in.docxSample Questions The following sample questions are not in.docx
Sample Questions The following sample questions are not in.docx
todd331
 
Introducción al Software Analítico SAS
Introducción al Software Analítico SASIntroducción al Software Analítico SAS
Introducción al Software Analítico SAS
Jorge Rodríguez M.
 
Sas base programmer
Sas base programmerSas base programmer
Sas base programmer
Aspire Techsoft Academy
 
Migration from 8.1 to 11.3
Migration from 8.1 to 11.3Migration from 8.1 to 11.3
Migration from 8.1 to 11.3
Suryakant Bharati
 
Dynamic Publishing with Arbortext Data Merge
Dynamic Publishing with Arbortext Data MergeDynamic Publishing with Arbortext Data Merge
Dynamic Publishing with Arbortext Data Merge
Clay Helberg
 

Similar to SAS - Training (20)

I need help with Applied Statistics and the SAS Programming Language.pdf
I need help with Applied Statistics and the SAS Programming Language.pdfI need help with Applied Statistics and the SAS Programming Language.pdf
I need help with Applied Statistics and the SAS Programming Language.pdf
 
BAS 150 Lesson 3 Lecture
BAS 150 Lesson 3 LectureBAS 150 Lesson 3 Lecture
BAS 150 Lesson 3 Lecture
 
Prog1 chap1 and chap 2
Prog1 chap1 and chap 2Prog1 chap1 and chap 2
Prog1 chap1 and chap 2
 
Sas summary guide
Sas summary guideSas summary guide
Sas summary guide
 
8323 Stats - Lesson 1 - 03 Introduction To Sas 2008
8323 Stats - Lesson 1 - 03 Introduction To Sas 20088323 Stats - Lesson 1 - 03 Introduction To Sas 2008
8323 Stats - Lesson 1 - 03 Introduction To Sas 2008
 
Sas
Sas Sas
Sas
 
Readme
ReadmeReadme
Readme
 
Top 140+ Advanced SAS Interview Questions and Answers.pdf
Top 140+ Advanced SAS Interview Questions and Answers.pdfTop 140+ Advanced SAS Interview Questions and Answers.pdf
Top 140+ Advanced SAS Interview Questions and Answers.pdf
 
Mysql
MysqlMysql
Mysql
 
Analytics with SAS
Analytics with SASAnalytics with SAS
Analytics with SAS
 
SAS Commands
SAS CommandsSAS Commands
SAS Commands
 
Sas-training-in-mumbai
Sas-training-in-mumbaiSas-training-in-mumbai
Sas-training-in-mumbai
 
Sas Talk To R Users Group
Sas Talk To R Users GroupSas Talk To R Users Group
Sas Talk To R Users Group
 
SAS_Overview_Short.pptx
SAS_Overview_Short.pptxSAS_Overview_Short.pptx
SAS_Overview_Short.pptx
 
BAS 150 Lesson 4 Lecture
BAS 150 Lesson 4 LectureBAS 150 Lesson 4 Lecture
BAS 150 Lesson 4 Lecture
 
Sample Questions The following sample questions are not in.docx
Sample Questions The following sample questions are not in.docxSample Questions The following sample questions are not in.docx
Sample Questions The following sample questions are not in.docx
 
Introducción al Software Analítico SAS
Introducción al Software Analítico SASIntroducción al Software Analítico SAS
Introducción al Software Analítico SAS
 
Sas base programmer
Sas base programmerSas base programmer
Sas base programmer
 
Migration from 8.1 to 11.3
Migration from 8.1 to 11.3Migration from 8.1 to 11.3
Migration from 8.1 to 11.3
 
Dynamic Publishing with Arbortext Data Merge
Dynamic Publishing with Arbortext Data MergeDynamic Publishing with Arbortext Data Merge
Dynamic Publishing with Arbortext Data Merge
 

Recently uploaded

Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
Zilliz
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 

Recently uploaded (20)

Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 

SAS - Training

  • 3. SAS stands for Statistical Analysis Software. It was created in the year 1960 by the SAS Institute. From 1st January 1960, SAS was used in • Data management • Business intelligence • Predictive Analysis • Descriptive Analysis • Prescriptive Analysis
  • 5. SAS is basically worked on large datasets. With the help of SAS software you can perform various operations on the data like • Data Management • Statistical Analysis • Report formation with perfect graphics • Business Planning • Operations Research and project Management • Quality Improvement • Application Development • Data extraction • Data transformation • Data updating and modification
  • 6. SAS Component & their Usage
  • 7. Sr. No SAS Component & their Usage 1 Base SAS It is a core component which contains data management facility and a programming language for data analysis. It is also the most widely used. 2 SAS/GRAPH Create graphs, presentations for better understanding and showcasing the result in a proper format. 3 SAS/STAT Perform Statistical analysis with the variance analysis, regression, multivariate analysis, survival analysis, and psychometric analysis, mixed model analysis. 4 SAS/OR Operations research. 5 SAS/ETS Econometrics and Time Series Analysis. 6 SAS/Enterprise Miner Data mining.
  • 11. https://www.virtualbox.org/wiki/Downloads The following screen appears when the above-stated link in clicked.
  • 12.
  • 13.
  • 14.
  • 15. When we enter this http://localhost:10080/, the following window opens up.
  • 16. The SAS studio window looks like the following screen.
  • 21. Server Files and Folders
  • 25. SAS Variable Names • It can be maximum 32 characters long. • It can not include blanks. • It must start with the letters A through Z (not case sensitive) or an underscore (_). • Can include numbers but not as the first character. • Variable names are case insensitive.
  • 26. SAS Data Set The DATA statement marks the creation of a new SAS data set. The rules for DATA set creation are as below. • A single word after the DATA statement indicates a temporary data set name. Which means the data set gets erased at the end of the session. • The data set name can be prefixed with a library name which makes it a permanent data set. Which means the data set persists after the session is over. • If the SAS data set name is omitted then SAS creates a temporary data set with a name generated by SAS like - DATA1, DATA2 etc.
  • 27. The SAS programs, data files and the results of the programs are saved with various extensions in windows. • .sas − It represents the SAS code file which can be edited using the SAS Editor or any text editor. • .log − It represents the SAS Log File it contains information such as errors, warnings, and data set details for a submitted SAS program. • .mht / *.html −It represents the SAS Results file. • .sas7bdat −It represents SAS Data File which contains a SAS data set including variable names, labels, and the results of calculations. SAS File Extensions
  • 28. Comments in SAS Following is a multiline comment example − /*message*/ type comment A comment in the form of /*message*/ is used more frequently and it can not be nested. But it can span multiple lines and can be of any length. Following is a single line comment example
  • 30. PROC Step This step involves invoking a SAS built-in procedure to analyze the data. Example The below example shows using the MEANS procedure to print the mean values of the numeric variables in the data set.
  • 32. String Functions SUBSTRN This function extracts a substring using the start and end positions. In case of no end position is mentioned it extracts all the characters till end of the string.
  • 33.
  • 37. Input Methods The input methods are used to read the raw data. The raw data may be from an external source or from in stream datalines. The input statement creates a variable with the name that you assign to each field. So you have to create a variable in the Input Statement. The same variable will be shown in the output of SAS Dataset. Below are different input methods available in SAS. • List Input Method • Named Input Method • Column Input Method • Formatted Input Method
  • 43. SAS can read data from various sources which includes many file formats. The file formats used in SAS environment is discussed below. • ASCII(Text) Data Set • Delimited Data • Excel Data • Hierarchical Data Reading ASCII(Text) Data Set
  • 47. Similar to reading datasets, SAS can write datasets in different formats. It can write data from SAS files to normal text file. These files can be read by other software programs. SAS uses PROC EXPORT to write data sets. PROC EXPORT It is a SAS inbuilt procedure used to export the SAS data sets for writing the data into files of different formats. Syntax The basic syntax for writing the procedure in SAS is −
  • 48. Following is the description of the parameters used − •SAS data-set is the data set name which is being exported. SAS can share the data sets from its environment with other applications by creating files which can be read by different operating systems. It uses the inbuilt EXPORT function to out the data set files in a variety of formats. In this chapter we will see the writing of SAS data sets using proc export along with the options dlm and dbms. •SAS data-set-options is used to specify a subset of columns to be exported. •filename is the name of the file to which the data is written into. •identifier is used to mention the delimiter that will be written into the file. •LABEL option is used to mention the name of the variables written to the file.
  • 49. On executing the above code we can see the output as a text file and right click on it to see its content as shown below.
  • 50. In order to write a comma delimited file we can use the dlm option with a value "csv". The following code writes the file car_data.csv. Writing a CSV file On executing the above code we get the below output.
  • 51. Concatenate Data Sets Multiple SAS data sets can be concatenated to give a single data set using the SET statement. The total number of observations in the concatenated data set is the sum of the number of observations in the original data sets. The order of observations is sequential. All observations from the first data set are followed by all observations from the second data set, and so on. Ideally all the combining data sets have same variables, but in case they have different number of variables, then in the result all the variables appear, with missing values for the smaller data set. Syntax The basic syntax for SET statement in SAS is −
  • 53.
  • 54. SAS offers extensive support to most of the popular relational databases by using SQL queries inside SAS programs. Most of the ANSI SQL syntax is supported. The procedure PROC SQL is used to process the SQL statements. This procedure can not only give back the result of an SQL query, it can also create SAS tables & variables. The example of all these scenarios is described below. Syntax The basic syntax for using PROC SQL in SAS is −
  • 55. SQL Create Operation Using SQL we can create new data set form raw data. In the below example, first we declare a data set named TEMP containing the raw data. Then we write a SQL query to create a table from the variables of this data set.
  • 56. When the above code is executed we get the following result −
  • 57. SQL Read Operation The Read operation in SQL involves writing SQL SELECT queries to read the data from the tables. In The below program queries the SAS data set named CARS available in the library SASHELP. The query fetches some of the columns of the data set.
  • 58.
  • 59. SQL SELECT with WHERE Clause The below program queries the CARS data set with a where clause. In the result we get only the observation which have make as 'Audi' and type as 'Sports'.
  • 60. SQL UPDATE Operation We can update the SAS table using the SQL Update statement. Below we first create a new table named EMPLOYEES2 and then update it using the SQL UPDATE statement.
  • 61. SQL DELETE Operation The delete operation in SQL involves removing certain values from the table using the SQL DELETE statement. We continue to use the data from the above example and delete the rows from the table in which the salary of the employees is greater than 900.
  • 62. SAS – ODS Output delivery system
  • 63. The output from a SAS program can be converted to more user friendly forms like .html or PDF. This is done by using the ODS statement available in SAS. ODS stands for output delivery system. It is mostly used to format the output data of a SAS program to nice reports which are good to look at and understand. That also helps sharing the output with other platforms and soft wares. It can also combine the results from multiple PROC statements in one single file. Syntax The basic syntax for using the ODS statement in SAS is −
  • 64. Following is the description of the parameters used − •PATH represents the statement used in case of HTML output. In other types of output we include the path in the filename. •Style represents one of the in-built styles available in the SAS environment.
  • 65. Creating HTML Output We create HTML output using the ODS HTML statement.In the below example we create a html file in our desired path. We apply a style available in the styles library. We can see the output file in the mentioned path and we can download it to save in an environment different from the SAS environment. Please note that we have two proc SQL statements and both their output is captured into a single file.
  • 66. When the above code is executed we get the following result −
  • 67. Creating PDF Output In the below example we create a PDF file in our desired path. We apply a style available in the styles library. We can see the output file in the mentioned path and we can download it to save in an environment different from the SAS environment. Please note that we have two proc SQL statements and both their output is captured into a single file.
  • 68. When the above code is executed we get the following result −
  • 69. Creating TRF(Word) Output In the below example we create a RTF file in our desired path. We apply a style available in the styles library. We can see the output file in the mentioned path and we can download it to save in an environment different from the SAS environment. Please note that we have two proc SQL statements and both their output is captured into a single file.
  • 70. When the above code is executed we get the following result −
  • 72. A Histogram is graphical display of data using bars of different heights. It groups the various numbers in the data set into many ranges. It also represents the estimation of the probability of distribution of a continuous variable. In SAS the PROC UNIVARIATE is used to create histograms with the below options. Syntax The basic syntax to create a histogram in SAS is − Following is the description of parameters used − •DATASET is the name of the dataset used. •variables are the values used to plot the histogram.
  • 73. Example In the below example, we consider the minimum and maximum values of the variable horsepower and take a range of 50. So the values form a group in steps of 50.
  • 74.
  • 75. Histogram with Curve Fitting We can fit some distribution curves into the histogram using additional options. Example In the below example we fit a distribution curve with mean and standard deviation values mentioned as EST. This option uses and estimate of the parameters.
  • 76.
  • 77. Simple Bar chart A simple bar chart is a bar chart in which a variable from the dataset is represented as bars. Example The below script will create a bar-chart representing the length of cars as bars.
  • 78.
  • 79. Stacked Bar chart A stacked bar chart is a bar chart in which a variable from the dataset is calculated with respect to another variable. Example The below script will create a stacked bar-chart where the length of the cars are calculated for each car type. We use the group option to specify the second variable.
  • 80.
  • 81. Clustered Bar chart The clustered bar chart is created to show how the values of a variable are spread across a culture. Example The below script will create a clustered bar-chart where the length of the cars is clustered around the car type.So we see two adjacent bars at length 191, one for the car type 'Sedan' and another for the car type 'Wagon'.
  • 82.
  • 83. Simple Pie Chart In this pie chart we take a single variable form the dataset. The pie chart is created with value of the slices representing the fraction of the count of the variable with respect to the total value of the variable. Example In the below example each slice represents the fraction of the type of car from the total number of cars.
  • 84.
  • 85. Pie Chart with Data Labels In this pie chart we represent both the fractional value as well as the percentage value for each slice. We also change the location of the label to be inside the chart. The style of appearance of the chart is modified by using the DATASKIN option. It uses one of the inbuilt styles, available in the SAS environment.
  • 86.
  • 87. Grouped Pie Chart In this pie chart the value of the variable presented in the graph is grouped with respect to another variable of the same data set. Each group becomes one circle and the chart has as many concentric circles as the number of groups available. Example In the below example we group the chart with respect to the variable named "Make". As there are two values available ("Audi" and "BMW") so we get two concentric circles each representing slices of car types in its own make.
  • 88.
  • 90. The arithmetic mean is the value obtained by summing value of numeric variables and then dividing the sum with the number of variables. It is also called Average. In SAS arithmetic mean is calculated using PROC MEANS. Using this SAS procedure we can find the mean of all variables or some variables of a dataset. We can also form groups and find mean of variables of values specific to that group Syntax The basic syntax for calculating arithmetic mean in SAS is − Following is the description of parameters used − •DATASET − is the name of the dataset used. •Variables − are the name of the variable from the dataset.
  • 91. Mean of a Dataset The mean of each of the numeric variable in a dataset is calculated by using the PROC by supplying only the dataset name without any variables. Example In the below example we find the mean of all the numeric variables in the SAS dataset named CARS. We specify the maximum digits after decimal place to be 2 and also find the sum of those variables.
  • 92.
  • 93. Mean of Select Variables We can get the mean of some of the variables by supplying their names in the var option. Example In the below we calculate the mean of three variables.
  • 94. Mean by Class We can find the mean of the numeric variables by organizing them to groups by using some other variables. Example In the example below we find the mean of the variable horsepower for each type under each make of the car.
  • 95.
  • 96. Standard deviation (SD) is a measure of how varied is the data in a data set. Mathematically it measures how distant or close are each value to the mean value of a data set. A standard deviation value close to 0 indicates that the data points tend to be very close to the mean of the data set and a high standard deviation indicates that the data points are spread out over a wider range of values In SAS the SD values is measured using PROC MEAN as well as PROC SURVEYMEANS. Using PROC MEANS To measure the SD using proc means we choose the STD option in the PROC step. It brings out the SD values for each numeric variable present in the data set. Syntax The basic syntax for calculating standard deviation in SAS is − Following is the description of the parameters used − •Dataset − is the name of the dataset.
  • 97. Example In the below example we create the data set CARS1 form the CARS data set in the SASHELP library. We choose the STD option with the PROC means step.
  • 98.
  • 99. A frequency distribution is a table showing the frequency of the data points in a data set. Each entry in the table contains the frequency or count of the occurrences of values within a particular group or interval, and in this way, the table summarizes the distribution of values in the sample. SAS provides a procedure called PROC FREQ to calculate the frequency distribution of data points in a data set. Syntax The basic syntax for calculating frequency distribution in SAS is − Following is the description of the parameters used − •Dataset is the name of the dataset. •Variables_1 is the variable names of the dataset whose frequency distribution needs to be calculated. •Variables_2 is the variables which categorised the frequency distribution result.
  • 100. Single Variable Frequency Distribution We can determine the frequency distribution of a single variable by using PROC FREQ. In this case the result will show the frequency of each value of the variable. The result also shows the percentage distribution, cumulative frequency and cumulative percentage. Example In the below example we find the frequency distribution of the variable horsepower for the dataset named CARS1 which is created form the library SASHELP.CARS. We can see the result divided into two categories of results. One for each make of the car.
  • 101.
  • 102. Multiple Variable Frequency Distribution We can find the frequency distributions for multiple variables which groups them into all possible combinations. Example In the below example we calculate the frequency distribution for the make of a car for grouped by car type and also the frequency distribution of each type of car grouped by each make.
  • 103. Cross tabulation involves producing cross tables also called contingent tables using all possible combinations of two or more variables. In SAS it is created using PROC FREQ along with the TABLES option. For example - if we need the frequency of each model for each make in each car type category, then we need to use the TABLES option of PROC FREQ. Syntax The basic syntax for applying cross tabulation in SAS is − Following is the description of the parameters used − •Dataset is the name of the dataset. •Variable_1 and Variable_2 are the variable names of the dataset whose frequency distribution needs to be calculated.
  • 104. Example Consider the case of finding how many car types are available under each car brand from the dataset cars1 which is created form SASHELP.CARS as shown below. In this case we need the individual frequency values as well as the sum of the frequency values across the makes and across the types. We can observer that the result shows values across the rows and the columns.
  • 105.
  • 106. The T-tests are performed to compute the confidence limits for one sample or two independent samples by comparing their means and mean differences. The SAS procedure named PROC TTEST is used to carry out t tests on a single variable and pair of variables. Syntax The basic syntax for applying PROC TTEST in SAS is − Following is the description of the parameters used − •Dataset is the name of the dataset. •Variable_1 and Variable_2 are the variable names of the dataset used in t test.
  • 107. Example Below we see one sample t test in which find the t test estimation for the variable horsepower with 95 percent confidence limits.
  • 108.
  • 109. Correlation analysis deals with relationships among variables. The correlation coefficient is a measure of linear association between two variables.Values of the correlation coefficient are always between -1 and +1. SAS provides the procedure PROC CORR to find the correlation coefficients between a pair of variables in a dataset. Syntax The basic syntax for applying PROC CORR in SAS is − Following is the description of the parameters used − •Dataset is the name of the dataset. •Options is the additional option with procedure like plotting a matrix etc. •Variable is the variable name of the dataset used in finding the correlation.
  • 110. Example Correlation coefficients between a pair of variables available in a dataset can be obtained by use their names in the VAR statement.In the below example we use the dataset CARS1 and get the result showing the correlation coefficients between horsepower and weight.
  • 111.
  • 112. Correlation Between All Variables Correlation coefficients between all the variables available in a dataset can be obtained by simply applying the procedure with the dataset name. Example In the below example we use the dataset CARS1 and get the result showing the correlation coefficients between each pair of the variables.
  • 113.
  • 114. Linear Regression is used to identify the relationship between a dependent variable and one or more independent variables. A model of the relationship is proposed, and estimates of the parameter values are used to develop an estimated regression equation. Various tests are then used to determine if the model is satisfactory. If it is then, the estimated regression equation can be used to predict the value of the dependent variable given values for the independent variables. In SAS the procedure PROC REG is used to find the linear regression model between two variables. Syntax The basic syntax for applying PROC REG in SAS is − Following is the description of the parameters used − •Dataset is the name of the dataset. •variable_1 and variable_2 are the variable names of the dataset used in finding the correlation.
  • 115. Example The below example shows the process to find the correlation between the two variables horsepower and weight of a car by using PROC REG. In the result we see the intercept values which can be used to form the regression equation.
  • 116.

Editor's Notes

  1. The below example shows a simple case of naming the data set, defining the variables, creating new variables and entering the data. Here the string variables have a $ at the end and numeric values are without it.
  2. Following is the description of the parameters used − data-set1,data-set2 are dataset names written one after another.