Introduction to SAS

Vinayak Mathur
VLearn Together
Published in
4 min readJun 9, 2020

SAS formerly called a Statistical Analysis System is a software package and, its application varies from programming to advanced analytics not to forget data management. SAS comes in different versions for different Operating Systems.
We will be starting with a brief introduction on what SAS does and how we can leverage its capabilities.

SAS is a powerful software tool that can help you with finding some sense in your data. There is a very popular framework that is used by programmers for understanding the SAS as a tool by following this framework you can have a solid foundation for using it, To understand how SAS works please read this before going into the framework,

PROC: Procedure Step which consists of statements and ends with a RUN statement.
This step has several options, some of which are mentioned further.

The framework is as follows,

How to access data (Accessing Data)

With SAS, you can use different files like excel, CSV and pdf to work upon, import of these files is easy and SAS can work with both structured as well as unstructured data, you can also access data through the libraries. One thing that you should know, SAS table is called a dataset, a column is called a variable, and a row is called an observation.
Syntax of accessing data with the help of code,

Syntax of accessing data with libraries,

Syntax of importing data,

Diving into Data(Exploring Data)

Displaying output tables, how to focus on particular segments of your data, seeing what values are contained in your dataset and sorting them.

Syntax

We can also find easy summary statistics while exploring data by,

For a detailed frequency report, we can use,

For sorting data,
PROC SORT DATA=input_table OUT=output_name;
by ASCENDING/DESCENDING column_names;
RUN;

Restructuring data (Processing)

When you learn about data initially, you would make some changes in it as per your requirements, these modifications and manipulations can be termed as the processing of data. These include filtering, creating copies of tables, using in-built SAS functions such as SUM, MAX, MEAN, MEDIAN, RANGE for numeric data, UPCASE, PROPCASE, CATS for character data and MONTH, YEAR, DAY for Date data.
Syntax,

Deriving meaning from data(Analysing)

Analyzing and reporting data is probably the most interesting part of this framework because during this procedure you will have to shift your attention from syntax to semantics because a dataset has a lot of different meanings and finding the right one is important. Report of the analysis is done as a follow-up of the analysis.
Syntax,

Eureka! (Results/Insights)

After the end of the previous step, you already have your result with you. It can be in the form of a trend or an insight which may be relevant to your firm, but the process is still not complete. Finally, you will have to export these results along with the data to back-up your new findings.
The syntax for exporting,

SAS provides an ODS, Output Delivery System for making exporting reports to other formats easier.
The syntax for ODS,

So you see, SAS has a wide range of features and we have only covered a few of them. These were the basics of SAS and we will soon come up with the next part of this article.

Please note that there are a lot of different options which are supported by SAS along with every statement. If this interests you then please don’t forget to check out the documentation which is available on the official SAS website for an in-depth tour of SAS.

--

--