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.

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)

100+ SAS Tutorials: Base to Advanced |

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.

- Introduction to SAS Programming
- Applications of SAS in Different Fields
- What SAS stands for
- 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.

- How to Upload Data to SAS OnDemand for Academics
- How to use PROC IMPORT in SAS
- Importing Excel Data into SAS
- Importing CSV Files into SAS
- Datalines Statement
- Cards Statement
- Reading / Importing Raw Data into SAS
- Read Character Variable of Varying Length

### How to Export Data

The following tutorials explain various ways to export SAS data.

### SAS Data Analysis Tutorials

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

- Creating or Modifying a Variable
- Dropping variables from a data set in SAS
- How to rename variables in SAS
- IF-Then-Else Statements
- Where Statement and Dataset Options
- WHERE vs. IF Statements
- How to Filter Data in SAS
- Proc Print : Step-by-step Guide
- How to use the IN Operator in SAS
- How Data Step and PROC SQL Works
- Calculate Frequency Distribution with PROC FREQ
- Specify a list of variables
- Use of WildCard Character
- Missing Values in SAS
- Convert Character Variable to Date
- Convert Numeric Variable to Date
- SAS Formats
- SAS Date Formats and Informats
- Proc Format
- First. and Last. Variables
- Proc Sort Tutorial
- Proc Sort : Identifying and storing unique and duplicate values
- Proc Means : Step-by-step Guide
- Proc Summary : Practical Guide
- Data Exploration with PROC UNIVARIATE
- Proc Contents : Practical Guide
- Proc Transpose Explained
- Proc Rank Explained
- Proc Datasets : Practical Guide
- Proc Compare : Practical Guide
- Proc Append: Combining Data in SAS
- Proc Report Explained
- Proc Tabulate Explained
- Use of Multiple Set Statements
- Joining and Merging in SAS
- SAS Many to Many Merge
- Retain Statement
- Calculating Percentiles with SAS
- SAS Arrays and DO Loops
- Length of Numeric Variables
- Check number of observations
- 4 Ways to Add Row Numbers in SAS
- Send SAS Output to Excel
- Handle Variable Name having Spaces
- Speed Up SAS Code with Index
- 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.

- SAS: Character Functions
- INPUT Function
- PUT Function
- SUBSTR Function
- INDEX Function
- SCAN Function
- FIND Function
- COMPRESS Function
- COUNTW Function
- STRIP Function
- TRANWRD and TRANSLATE Functions
- Convert Strings to Lowercase, Uppercase & Proper Case
- Concatenate Functions - CAT, CATT, CATS, CATX
- Pattern Matching - PRXMATCH and PRXCHANGE Functions
- Fuzzy Matching - COMPGED Function

- SAS: Date Functions
- SAS : Time and DateTime Functions
- SAS: Numeric Functions

## 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.

- Proc SQL Tutorial for Beginners (20 Examples)
- CASE WHEN Statement in PROC SQL
- Proc SQL Joins (Merging)
- Combining Tables Vertically with PROC SQL
- Insert Rows in the Table
- Alter Table and Update Column
- Intermediate PROC SQL Tutorial
- Proc SQL Self Joins
- Connect to Teradata using SAS
- Join on Multiple Columns
- Join on Multiple Tables
- Comparing two tables
- Find records only exist in one table
- Random Sampling with PROC SQL
- Alternative to _N_ in PROC SQL
- NODUPKEY with PROC SQL
- 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.

- SAS Macro Programming
- SAS: CALL SYMPUT and CALL SYMPUTX
- Difference between SYMPUT and SYMGET
- Multiple Ampersand Macro Variables
- CALL EXECUTE made easy
- Stop SAS Macro Processing on Error
- Count number of variables assigned in a macro variable
- Example of a dynamic %DO Loop
- Get Variable Names from a Dataset
- Run SAS Procedure on Multiple Datasets
- Building SAS Macro Library
- Dropping Variables Ending with a Specific String
- Importing multiple excel files in a single dataset
- Importing multiple excel sheets in a single dataset
- Imputing Missing Data
- Identify and Remove Outliers with SAS
- Test for Normal Distribution
- 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.

- Clinical SAS Programming: Complete Guide
- 4 Ways to Select a Random Sample in SAS
- How to Calculate Difference Between Dates in SAS
- How to Add Days to Dates in SAS
- Read ZIP or GZ Files in SAS
- Avoid Truncation while Importing CSV Files
- Custom Sort Order in SAS
- Count Distinct Values in Variables
- Count Missing Values
- Count Missing and Non-Missing Values Row-Wise
- 3 Ways to Calculate Standard Deviation in SAS
- 4 ways to find maximum value in a group with SAS
- Extract last 4 characters / digits of value
- When to use IF and %IF in SAS Macro
- Find Variable with Max or Min across Rows
- 4 Ways to calculate LAG and LEAD
- Dropping Variables Ending with a Specific String
- Identifying and Storing Unique and Duplicate Values
- Delete empty rows in SAS
- Comparing two data sets
- Reordering Variables
- Transpose Multiple Variables
- Reverse order of data
- Extracting numbers and text from alphanumeric string
- Dropping variables ending with a specific string
- Add leading zeros
- Remove leading zeros
- Advanced String Manipulation
- Fuzzy String Matching
- Calculating Percentiles with SAS
- Extract Second Non-Missing Value
- Zip / Unzip SAS Datasets
- Clearing Log and Output Windows
- Variable Names Truncated in PROC Logistic
- Driving Distance with SAS
- Send Emails with Attachments via SAS
- Run R code from SAS
- VBA in SAS
- Wish Christmas with SAS
- Run ChatGPT inside SAS
- Run Gemini AI Model inside SAS
- How CHATGPT-4 aced SAS Certification with 93% score
- 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.

- How to Standardize Variables
- How to Calculate Z-score in SAS
- How to Fill Missing Values in SAS
- How to Perform T-test in SAS
- How to Perform ANOVA in SAS
- How to Perform Two-Way ANOVA in SAS
- Correlation Analysis with SAS
- Split Data into Training and Test Datasets in SAS
- How to Calculate VIF in SAS
- Linear Regression with SAS
- Logistic Regression with SAS
- Decision Tree with SAS
- Random Forest with SAS
- Time Series Forecasting : ARIMA
- Cluster Analysis using SAS
- Ridge Regression with SAS
- Principal Component Analysis (PCA) with SAS
- Variable Selection (PROC VARCLUS) Explained
- How to Create ROC Curve in SAS
- Checking Assumptions of Multiple Regression
- Checking Homoscedasticity with SAS
- Scoring Linear Regression Model with SAS
- Detecting Interaction in Regression Model
- Bootstrapping Logistic Regression
- Chi-Square as Variable Reduction Technique
- Oversampling for rare event
- Multiple Imputation with SAS
- Brier Score for Model Calibration
- 2 Ways to score validation sample in PROC LOGISTIC
- Understand AUC
- Calculating AUC of Validation Dataset
- 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.

- SAS Base Certification Q&A - Part I
- SAS Base Certification Q&A - Part II
- SAS Base Certification Q&A - Part III
- SAS Base Certification Q&A - Part IV
- 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.

## 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.