Zencos has merged with Executive Information Systems (EIS)
twitter-icon
Free Strategy Consultation
Zencos Icon

Services

Contact Us

Blog

Visual Tour of the SAS DS2 Procedure

Advanced Analytics

Maria Nicholson

06/27/2017

DS2 is a new object-oriented programming language introduced in SAS 9.4 that functions within a procedure (PROC). It is included with Base SAS so you can use it in SAS programming environments like SAS Enterprise Guide and SAS Studio.

DS2 is not necessarily meant to be a replacement for the Data Step, so don’t think that you have to convert all your existing programs to DS2. However, DS2 does have advantages in certain areas: additional data types, ANSI SQL types – FedSQL is a SAS implementation of the ANSI SQL types, programming structure elements, and user-defined methods and packages.

What Do You Need To Know about PROC DS2?

An updated Data Step

  • New supported data types that follow most ANSI standards. This includes VARCHAR, INTEGER, FLOAT, BINARY, and other DATETIME data types. See here for the complete list.
  • RUN/INIT/TERM are automatic system methods run for every DS2 program
  • Executable code must be in a method

User Defined Methods

  • Users can create their own methods to keep their program organized between calculations and processes
  • User defined methods must be called in order to execute
  • User defined methods can be defined within a reusable user defined package (class).

Parallel Processing with Threads

  • Even though it still uses the implicit loop when processing a data step, DS2 can spread that process out across multiple threads.
  • Threads can be useful if you have a bottleneck at the CPU processing level

Applying PROC DS2 To Your Code

Want to see an example of PROC DS2, check out the PROC DS2 First Impressions where I walk you through an example using warranty data.

For a deep dive into PROC DS2, read Mastering the SAS DS2 Procedure: Advanced Data Wrangling Techniques by Mark Jordan.

Related Insights

Blog

How Successfully Migrate Your SAS Environment to the Cloud

Blog

Using SAS Data Integration Studio to Load Covid-19 Case Surveillance Data

Blog

Bridge Your Analytical Code Gaps: How to Build Custom Applications with SAS Viya

WhitePaper

Popping the Hood on Query Execution