SAS Tutorial for Beginners to Advanced - Practical Guide

In this SAS tutorial, we will explain how you can learn SAS programming online on your own. It includes many base and advanced tutorials which would help you to get started with SAS and you will acquire knowledge of data exploration and manipulation, predictive modeling using SAS along with some scenario based examples for practice.
Table of Contents

What is SAS?

SAS (Statistical analysis system) is one of the most popular software for data analysis. It is widely used for various purposes such as data management, data mining, report writing, statistical analysis, business modeling, applications development and data warehousing. Knowing SAS is an asset in many job markets. It is tagged 'leader' in Advanced Analytics Platforms as per Gartner 2019 Magic Quadrant for Data Science & Machine Learning Platforms.
Top SAS Tutorials
100+ SAS Tutorials: Base to Advanced

Why SAS is popular in job market?

SAS has over 40,000 customers worldwide and holds largest market share in advanced analytics. It has been tagged 'leader' consistently for last 6 consecutive years in advanced analytics platforms. In finance (BFSI) industry, SAS retains No. 1 spot and is being used as a primary tool for data manipulation and predictive modeling.
  • Data Security - Because of unparalleled data security provided by SAS software, it is leading the analytics software industry in BFSI sector.
  • Tech Customer Support - SAS provides one of the best tech support. If you are stuck in anything related to SAS whether it is installation related issue or clarity in any of SAS functions and procedures, they have both online and offline community to support you.
  • Detailed Documentation - SAS documentation is very detailed as compared to open source software like R and Python.
  • Memory Management - SAS can store datasets on hard drive and process bigger data set than size of your RAM.
  • Stable Software more important than cost of software license : All the functions and procedures of previous software version are supported in new SAS versions. Cost of software license is a peanut to a bank or pharmaceutical company.
  • Legacy System - Many banks have been using SAS for last 20-30 years and they have automated the whole process of analysis and have written millions of lines of working code. To convert all the stable reporting system from SAS to R/Python, it may require significant additional cost.

SAS Modules

When you install SAS software, it has several in-built modules which are designed for various analytics and reporting purposes. See some of the common SAS modules or components.
  • Base SAS - It is the most common SAS module. It is used for data manipulation such as filtering data, selecting, renaming or removing columns, reshaping data etc.
  • SAS/STAT - It runs popular statistical techniques such as Hypothesis Testing, Linear and Logistic Regression, Principal Component Analysis etc.
  • SAS/ACCESS - It lets you to read data from databases such as Teradata, SQL Server, Oracle DB2 etc.
  • SAS/GRAPH - You can create simple and complex graphs using this component.
  • SAS/ETS - You can perform time series forecasting such as ARIMA, Exponential Smoothing, Moving Average etc. using this module.

How to download and install SAS Software

SAS Software is available for free. It's not a trial version but a complete software with almost all the functionalities of paid enterprise version of SAS. There are following two ways you can access SAS software.
1. SAS University Edition
  • Installation Required
  • Run on local machine (laptop / Desktop)
  • No Internet Required
2. SAS OnDemand for Academics
  • No Installation Required. Set up your account by registering yourself
  • You can access it from anywhere as it is run on cloud
  • Internet Required
  • Don't go by software name 'Academics'. It is available for everyone not just college students
These two lessons provides step by step detailed documentation on how to download and install SAS software .
  1. Free SAS Access - No Install Required

SAS Tutorial for Beginners

The following articles are designed for beginners who have no programming background or new to SAS programming language. You will learn fundamentals of SAS and how you can develop and run your first SAS program.
  1. Getting Started with SAS
  2. What SAS stands for
  3. Reading / Importing Raw Data into SAS
  4. SAS keyboard shortcuts that every analyst must know

Base SAS Tutorials

These posts are designed to cover all the topics of Base SAS certification. It includes explanation of topics on data structures, data management, data analysis and report generation.
  1. Importing Excel Data into SAS
  2. Read Character Variable of Varying Length
  3. Creating or Modifying a Variable
  4. Dropping variables from a data set in SAS
  5. IF-Then-Else Statements
  6. Where Statement and Dataset Options
  7. WHERE vs. IF Statements
  8. How Data Step and PROC SQL Works
  9. Calculate Frequency Distribution with PROC FREQ
  10. Specify a list of variables
  11. Use of WildCard Character
  12. Character Functions
  13. SAS Date Formats and Informats
  14. Date Functions
  15. INTCK Function with Examples
  16. INTNX Function with Examples
  17. Missing Values in SAS
  18. Convert Character Variable to Date
  19. Convert Numeric Variable to Date
  20. Proc Format
  21. Delete empty rows in SAS
  22. First. and Last. Variables
  23. Proc Sort : Identifying and storing unique and duplicate values
  24. Proc Means : A Detailed Explanation
  25. Use of Multiple Set Statements
  26. Joining and Merging in SAS
  27. SAS Many to Many Merge
  28. Combining and Aggregating Data in SAS
  29. Retain Statement
  30. Proc Transpose Explained
  31. Proc Univariate Tutorial
  32. Proc Rank Explained
  33. Calculating Percentiles with SAS
  34. COALESCE Function
  35. COMPGED Function
  36. SAS Arrays and DO Loops
  37. Proc Tabulate Explained
  38. Length of Numeric Variables
  39. Check number of observations
  40. Pattern Matching with SAS
  41. Send SAS Output to Excel
  42. Handle Variable Name having Spaces
  43. Speed Up SAS Code with Index

SAS Advanced : Proc SQL

The following lessons are intended for people who are new to SQL programming language. PROC SQL is an advanced SAS procedure that helps to run SQL queries to manage and manipulate data. It includes Introduction of SQL with examples, PROC SQL Joins, conditional statements and useful tips and tricks of SQL etc.
  1. Proc SQL Tutorial for Beginners (20 Examples)
  2. Proc SQL Joins (Merging)
  3. Combining Tables Vertically with PROC SQL
  4. Insert Rows in the Table
  5. Alter Table and Update Column
  6. Intermediate PROC SQL Tutorial
  7. Proc SQL Self Joins
  8. Connect to Teradata using SAS
  9. Join on Multiple Columns
  10. Join on Multiple Tables
  11. Comparing two tables
  12. Find records only exist in one table
  13. Random Sampling with PROC SQL
  14. Alternative to _N_ in PROC SQL

SAS Advanced : SAS Macros

SAS Macro is used to automate the repetitive tasks i.e. tasks that you perform very frequently (every day or more than once in a day). It includes useful tips and tricks of SAS Macro programming and outlines real world examples of automation with SAS Macros.
  1. SAS Macro Programming
  2. Difference between SYMPUT and SYMGET
  3. Multiple Ampersand Macro Variables
  4. CALL EXECUTE made easy
  5. Stop SAS Macro Processing on Error
  6. Count number of variables assigned in a macro variable
  7. Example of a dynamic %DO Loop
  8. Get Variable Names from a Dataset
  9. Run SAS Procedure on Multiple Datasets
  10. Building SAS Macro Library
  11. Dropping Variables Ending with a Specific String
  12. Importing multiple excel files in a single dataset
  13. Importing multiple excel sheets in a single dataset
  14. Imputing Missing Data
  15. Identify and Remove Outliers with SAS
  16. Test for Normal Distribution
  17. Reordering Variables

Practical Problem-Solving SAS Examples

It helps you to get your hands dirty with real-world SAS programming examples. You would both learn and practice by understanding these examples.
  1. Read ZIP or GZ Files in SAS
  2. Avoid Truncation while Importing CSV Files
  3. Custom Sort Order in SAS
  4. Count Distinct Values in Variables
  5. Count Missing and Non-Missing across columns
  6. 4 ways to find maximum value in a group with SAS
  7. Extract last 4 characters / digits of value
  8. When to use IF and %IF in SAS Macro
  9. Find Variable with Max or Min across Rows
  10. 4 Ways to calculate LAG and LEAD
  11. Dropping Variables Ending with a Specific String
  12. Identifying and Storing Unique and Duplicate Values
  13. Delete empty rows in SAS
  14. Comparing two data sets
  15. Reordering Variables
  16. Transpose Multiple Variables
  17. Reverse order of data
  18. Extracting numbers and text from alphanumeric string
  19. Dropping variables ending with a specific string
  20. Add leading zeros
  21. Remove leading zeros
  22. Advanced String Manipulation
  23. Fuzzy String Matching 
  24. Calculating Percentiles with SAS
  25. Extract Second Non-Missing Value
  26. Zip / Unzip SAS Datasets
  27. Clearing Log and Output Windows
  28. Variable Names Truncated in PROC Logistic
  29. Driving Distance with SAS
  30. Send Emails with Attachments via SAS
  31. Run R code from SAS
  32. VBA in SAS
  33. Wish Christmas with SAS

SAS Analytics / Statistics Tutorial

This section covers how to perform data exploration and statistical analysis with SAS. It explains how to perform descriptive and inferential statistics, linear and logistic regression, time series analysis, variable selection and reduction, cluster analysis and predictive modeling with SAS etc. It will help you to generate insights out of data using statistical techniques.
  1. Data Exploration with PROC UNIVARIATE
  2. Linear Regression with SAS
  3. Logistic Regression with SAS
  4. Time Series Forecasting : ARIMA
  5. Cluster Analysis using SAS
  6. Ridge Regression with SAS
  7. Principal Component Analysis (PCA) with SAS
  8. Variable Selection (PROC VARCLUS) Explained
  9. Checking Assumptions of Multiple Regression
  10. Checking Homoscedasticity with SAS
  11. Scoring Linear Regression Model with SAS
  12. Detecting Interaction in Regression Model
  13. Bootstrapping Logistic Regression
  14. Chi-Square as Variable Reduction Technique
  15. Oversampling for rare event
  16. Multiple Imputation with SAS
  17. Brier Score for Model Calibration
  18. 2 Ways to score validation sample in PROC LOGISTIC
  19. Understand AUC
  20. Calculating AUC of Validation Dataset
  21. Calculating KS Test

SAS Certification Questions and Answers

These posts outline the sample SAS Base and SAS Statistical Business Analyst certification questions and answers which helps you prepare for the certification. All questions asked are multiple choice questions, in which there is only one correct answer. It includes questions on SAS functions, procedures, data management, ANOVA, regression, predictive modeling and report generation etc.
  1. SAS Base Certification Q&A - Part I
  2. SAS Base Certification Q&A - Part II
  3. SAS Base Certification Q&A - Part III
  4. SAS Base Certification Q&A - Part IV
  5. SAS Statistical Business Analyst Certification

SAS Interview Questions and Answers

It covers more than 50 most frequently asked base and advanced SAS interview questions and answers. It is a collection of SAS Interviews questions beneficial for both freshers and experienced programmer.
  1. Base SAS Interview Questions and Answers
  2. Advanced SAS Interview Questions and Answers

Analytics Companies using SAS

It covers questions about "Scope of SAS", list of companies using SAS in India by geography and domain. Analytics Companies Using SAS in India

SAS Graphs / Charts

It includes tips and techniques to create common graphs or charts with SAS. It also provides methods to decorate charts so that they look professional and add WOW factor to your presentation. Guide : Create Charts with SAS
Spread the Word!