SAS Tutorial: Hands-On Approach for Beginners to Advanced Users

In this SAS tutorial, we will show you how to learn SAS programming on your own. Whether you're a beginner or an advanced user, this tutorial offers a hands-on approach. It covers a wide range of base and advanced tutorials that will help you get started with SAS.

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 the following :

  • Data Management
  • Data Warehousing
  • Report Writing
  • Statistical Analysis
  • Machine Learning
  • Natural language processing (NLP)
Top SAS Tutorials
100+ SAS Tutorials: Base to Advanced
Popularity of SAS 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 few years in advanced analytics platforms. In the finance (BFSI) and clinical research domains, SAS is used as a primary tool for data analysis and predictive modeling for the following reasons:

  • 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.
  • 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 is not difficult to learn and can be learned within 1-2 months.

SAS has several modules but it mainly divides into 3 sections - Base SAS, Advanced SAS and SAS Statistics.

You can learn Base SAS in a month or sooner depending on the amount of efforts you put in practice SAS. Once you finish with base SAS you can jump to advanced SAS or SAS Statistics depending on your interest.

It may take a longer period of time to learn SAS Statistics if you don't have prior knowledge of statistics. SAS Statistical procedures are straight-forward but how they are used in real-world case studies requires professional experience or you can try to solve kaggle case studies using SAS.

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.

The following tutorial provides step by step guide on how to access SAS software for free.
Free SAS Access - No Install Required

SAS OnDemand for Academics runs on cloud so you need only internet connection and no need to worry about poor configuration of your laptop/desktop. If you have licensed SAS software which is installed on your machine or server, you can run it easily with 4GB RAM and i3 Processor.

Companies typically use SAS Enterprise Guide which has a different interface compared to SAS OnDemand for Academics but they are exactly the same when it comes to programming. The only difference between them is the interface or editor used in your workplace as well as the server running them.

In short, your focus should be on learning SAS programming concepts and practicing them. Getting comfortable with the interface takes only a few minutes, and during interviews, companies evaluate candidates based on their programming knowledge rather than their familiarity with a specific interface.

When you install SAS software, it has several built-in modules which are used for various analytics and reporting purposes.

  • Base SAS - It is the most common SAS module. It is used for data manipulation such as filtering data, selecting, renaming or removing columns 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.
Table of Contents

Base SAS Tutorials

SAS Introduction Tutorial for Beginners

These tutorials are designed for beginners who have no prior programming background or are new to the SAS programming language. You will learn the fundamentals of SAS and how to develop and run your first SAS program.

  1. Introduction to SAS Programming
  2. Applications of SAS in Different Fields
  3. What SAS stands for
  4. SAS keyboard shortcuts that every analyst must know

How to Import Data

The following tutorials explain how to import data of various formats into SAS.

  1. How to Upload Data to SAS OnDemand for Academics
  2. How to use PROC IMPORT in SAS
  3. Importing Excel Data into SAS
  4. Importing CSV Files into SAS
  5. Datalines Statement
  6. Cards Statement
  7. Reading / Importing Raw Data into SAS
  8. Read Character Variable of Varying Length

How to Export Data

The following tutorials explain various ways to export SAS data.

  1. Proc Export : Practical Guide
  2. Exporting SAS Data to CSV File
  3. Exporting SAS Data to Excel File

SAS Data Analysis Tutorials

Here is a list of tutorials that would help you to handle and analyze data in SAS.

  1. Creating or Modifying a Variable
  2. Dropping variables from a data set in SAS
  3. How to rename variables in SAS
  4. IF-Then-Else Statements
  5. Where Statement and Dataset Options
  6. WHERE vs. IF Statements
  7. How to Filter Data in SAS
  8. Proc Print : Step-by-step Guide
  9. How to use the IN Operator in SAS
  10. How Data Step and PROC SQL Works
  11. Calculate Frequency Distribution with PROC FREQ
  12. Specify a list of variables
  13. Use of WildCard Character
  14. Missing Values in SAS
  15. Convert Character Variable to Date
  16. Convert Numeric Variable to Date
  17. SAS Formats
  18. SAS Date Formats and Informats
  19. Proc Format
  20. First. and Last. Variables
  21. Proc Sort Tutorial
  22. Proc Sort : Identifying and storing unique and duplicate values
  23. Proc Means : Step-by-step Guide
  24. Proc Summary : Practical Guide
  25. Data Exploration with PROC UNIVARIATE
  26. Proc Contents : Practical Guide
  27. Proc Transpose Explained
  28. Proc Rank Explained
  29. Proc Datasets : Practical Guide
  30. Proc Compare : Practical Guide
  31. Proc Append: Combining Data in SAS
  32. Proc Report Explained
  33. Proc Tabulate Explained
  34. Use of Multiple Set Statements
  35. Joining and Merging in SAS
  36. SAS Many to Many Merge
  37. Retain Statement
  38. Calculating Percentiles with SAS
  39. SAS Arrays and DO Loops
  40. Length of Numeric Variables
  41. Check number of observations
  42. 4 Ways to Add Row Numbers in SAS
  43. Send SAS Output to Excel
  44. Handle Variable Name having Spaces
  45. Speed Up SAS Code with Index
  46. Convert Unix Datetime to SAS Datetime

SAS Functions

Here is a valuable collection of tutorials on various functions in SAS. These functions make it easier for you to work with data.

Advanced SAS Tutorials : Proc SQL

These tutorials are ideal for people who are new to SQL programming. PROC SQL is an advanced SAS procedure for SQL. It allows us to run SQL queries.

  1. Proc SQL Tutorial for Beginners (20 Examples)
  2. CASE WHEN Statement in PROC SQL
  3. Proc SQL Joins (Merging)
  4. Combining Tables Vertically with PROC SQL
  5. Insert Rows in the Table
  6. Alter Table and Update Column
  7. Intermediate PROC SQL Tutorial
  8. Proc SQL Self Joins
  9. Connect to Teradata using SAS
  10. Join on Multiple Columns
  11. Join on Multiple Tables
  12. Comparing two tables
  13. Find records only exist in one table
  14. Random Sampling with PROC SQL
  15. Alternative to _N_ in PROC SQL
  16. NODUPKEY with PROC SQL
  17. Use DISTINCT in CASE WHEN

Advanced SAS Tutorials : 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. SAS: CALL SYMPUT and CALL SYMPUTX
  3. Difference between SYMPUT and SYMGET
  4. Multiple Ampersand Macro Variables
  5. CALL EXECUTE made easy
  6. Stop SAS Macro Processing on Error
  7. Count number of variables assigned in a macro variable
  8. Example of a dynamic %DO Loop
  9. Get Variable Names from a Dataset
  10. Run SAS Procedure on Multiple Datasets
  11. Building SAS Macro Library
  12. Dropping Variables Ending with a Specific String
  13. Importing multiple excel files in a single dataset
  14. Importing multiple excel sheets in a single dataset
  15. Imputing Missing Data
  16. Identify and Remove Outliers with SAS
  17. Test for Normal Distribution
  18. Reordering Variables

Practical Problem-Solving SAS Examples

The tutorials provided below offer practical lessons that showcase real-world examples of SAS programming. These tutorials aim to provide you with hands-on experience in utilizing the SAS language. By actively engaging with these examples, you will have the chance to practice your skills and apply your knowledge to scenario-based SAS questions.

  1. Clinical SAS Programming: Complete Guide
  2. 4 Ways to Select a Random Sample in SAS
  3. How to Calculate Difference Between Dates in SAS
  4. How to Add Days to Dates in SAS
  5. Read ZIP or GZ Files in SAS
  6. Avoid Truncation while Importing CSV Files
  7. Custom Sort Order in SAS
  8. Count Distinct Values in Variables
  9. Count Missing Values
  10. Count Missing and Non-Missing Values Row-Wise
  11. 3 Ways to Calculate Standard Deviation in SAS
  12. 4 ways to find maximum value in a group with SAS
  13. Extract last 4 characters / digits of value
  14. When to use IF and %IF in SAS Macro
  15. Find Variable with Max or Min across Rows
  16. 4 Ways to calculate LAG and LEAD
  17. Dropping Variables Ending with a Specific String
  18. Identifying and Storing Unique and Duplicate Values
  19. Delete empty rows in SAS
  20. Comparing two data sets
  21. Reordering Variables
  22. Transpose Multiple Variables
  23. Reverse order of data
  24. Extracting numbers and text from alphanumeric string
  25. Dropping variables ending with a specific string
  26. Add leading zeros
  27. Remove leading zeros
  28. Advanced String Manipulation
  29. Fuzzy String Matching 
  30. Calculating Percentiles with SAS
  31. Extract Second Non-Missing Value
  32. Zip / Unzip SAS Datasets
  33. Clearing Log and Output Windows
  34. Variable Names Truncated in PROC Logistic
  35. Driving Distance with SAS
  36. Send Emails with Attachments via SAS
  37. Run R code from SAS
  38. VBA in SAS
  39. Wish Christmas with SAS
  40. Run ChatGPT inside SAS
  41. Run Gemini AI Model inside SAS
  42. How CHATGPT-4 aced SAS Certification with 93% score
  43. Run SAS in Python without Installation

SAS Analytics / Statistics Tutorials

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. How to Standardize Variables
  2. How to Calculate Z-score in SAS
  3. How to Fill Missing Values in SAS
  4. How to Perform T-test in SAS
  5. How to Perform ANOVA in SAS
  6. How to Perform Two-Way ANOVA in SAS
  7. Correlation Analysis with SAS
  8. Split Data into Training and Test Datasets in SAS
  9. How to Calculate VIF in SAS
  10. Linear Regression with SAS
  11. Logistic Regression with SAS
  12. Decision Tree with SAS
  13. Random Forest with SAS
  14. Time Series Forecasting : ARIMA
  15. Cluster Analysis using SAS
  16. Ridge Regression with SAS
  17. Principal Component Analysis (PCA) with SAS
  18. Variable Selection (PROC VARCLUS) Explained
  19. How to Create ROC Curve in SAS
  20. Checking Assumptions of Multiple Regression
  21. Checking Homoscedasticity with SAS
  22. Scoring Linear Regression Model with SAS
  23. Detecting Interaction in Regression Model
  24. Bootstrapping Logistic Regression
  25. Chi-Square as Variable Reduction Technique
  26. Oversampling for rare event
  27. Multiple Imputation with SAS
  28. Brier Score for Model Calibration
  29. 2 Ways to score validation sample in PROC LOGISTIC
  30. Understand AUC
  31. Calculating AUC of Validation Dataset
  32. Calculating KS Test

SAS Certification Questions and Answers

These tutorials 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 100 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

Data Visualizations with SAS Graphs

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.

  1. How to Create Charts with SAS
  2. Create Bar Chart in SAS
  3. Create Histogram in SAS
  4. Create Scatter Plot in SAS
  5. Create Box Plot in SAS
Spread the Word!
Share