SAS language. The SAS language is a fourth-generation computer programming language used for statistical analysis, created by Anthony James Barr at North Carolina State University. Its primary applications include data mining and machine learning. The SAS language runs under compilers such as the SAS System that can be used on Microsoft Windows, Linux, UNIX and mainframe computers.

History 

SAS was developed in the 1960s by Anthony James Barr, who built its fundamental structure,  and SAS Institute CEO James Goodnight, who developed a number of features including analysis procedures. The language is currently developed and sponsored by the SAS Institute, of which Goodnight is founder and CEO.

Language 
Base SAS is a fourth-generation procedural programming language designed for the statistical analysis of data. It is Turing-complete and domain specific, with many of the attributes of a command language. As an interpreted language, it is generally parsed, compiled, and executed step by step. The SAS system was originally a single instruction, single data (SISD) engine, but single instruction, multiple data (SIMD) and multiple instruction, multiple data (MIMD) functionality was later added. Most base SAS code can be ported between versions, but some are functions and parameters are specific to certain operating systems and interfaces.

All SAS programs are written within the SAS language, although some packages use menu-driven graphical user interfaces on the front-end. Various SAS editors use color coding to identify components like step boundaries, keywords and constants. It can read in data from common spreadsheets and databases and output the results of statistical analyses in tables, graphs, and as RTF, HTML and PDF documents.

Syntax 
The language consists of two main types of blocks: DATA blocks and PROC blocks. DATA blocks can be used to read and manipulate input data, and create data sets. PROC blocks are used to perform analyses and operations on these data sets, sort data, and output results in the form of descriptive statistics, tables, results, charts and plots. PROC SQL can be used to work with SQL syntax within SAS.

Users can input both numeric and character data into base SAS. SAS statements must begin with a reserved keyword and end with  but the language is otherwise flexible in terms of formatting and most statements are case insensitive. SAS statements can continue across multiple lines and do not require indenting, although indents can improve readability. Comments are delimited by  and .

A standard SAS program typically entails the definition of data, the creation of a data set, and the performance of procedures such as analysis on that data set. SAS scripts have the .sas extension.

A simple example of SAS code is the following
* COMMENT;
Data TEMP;
   input X Y Z;
   datalines;
1 2 3
5 6 7
;
run;

PROC PRINT DATA = TEMP;
RUN;

SAS macro language 
The SAS macro language is made available within base SAS software to reduce the amount of code, and create code generators for building more versatile and flexible programs. The macro language can be used for functionalities as simple as symbolic substitution and as complex as dynamic programming. SAS macro is considered to be a rich language, although its overall syntax is very similar to that of base SAS. The names of macro variables in SAS are usually preceded by , while macro program statements are usually preceded by .

Software 

SAS Institute develops a number of tools and software suites, also called SAS, which are used for creating programs in the language. These suites include JMP, SAS Viya, SAS Enterprise Guide and SAS Enterprise Miner. In 2002, World Programming also developed software that allows the execution of most SAS scripts.

Uses 
The SAS language is used as a standard in many industries, and was ranked #22 on the TIOBE index in February 2024. It is especially widely used for machine learning, data mining, and data warehousing in the finance, insurance, manufacturing, health care and pharmaceutical industries. It has a high level of documentation and community support, which has contributed to its uptake.

Machine learning 
SAS is used for preparing input data, and building and optimizing machine learning algorithms. Various models, such as artificial neural networks (ANN), convolutional neural networks and deep learning models, are developed and trained in SAS. These are applied to areas such as computer vision and fraud detection. SAS has also been noted for its applications in the area of decision intelligence.

Data mining and warehousing 
While SAS was originally developed for data analysis, it became an important language for data storage. SAS is one of the primary languages used for data mining in business intelligence and statistics. According to Gartner's Magic Quadrant and Forrester Research, the SAS Institute is one of the largest vendors of data mining software.

See also 

 List of statistical packages
 Comparison of statistical packages
 SAS Institute Inc v World Programming Ltd

Notes

References

External links 
 Learn SAS Programming
 comp.soft-sys.sas at Google Groups.
 UK High Court Judgement on SAS Language
 Sasopedia / SAS Language elements
 SAS whitepaper search

Statistical programming languages

SAS Institute