BookmarkSubscribeRSS Feed

The Fundamentals of DATA Step Programming

Started ‎08-04-2020 by
Modified ‎08-04-2020 by
Views 2,093

In this tutorial, SAS user Arthur Li addresses a common issue encountered by new SAS® programmers: that the SAS data set that they create is not what they intended to create. These types of mistakes are most commonly committed, he says, because programming novices learn SAS language syntax without understanding the fundamental SAS programming concepts.


You'll learn how DATA step programming operates in three parts:


  1. The Essence of DATA Step Programming
  2. How Best to Write a Loop in the DATA Step
  3. The Many Ways to Effectively Utilize Array Processing




Video highlights

0:00:00 – Overview and outline

0:00:45 – Understanding how the DATA Step works

0:11:09 – Importance of the OUTPUT Statement

0:12:29 – Differences in a Raw Data Set and a SAS Data Set

0:16:12 – RETAIN statement values

0:21:30 – SUM Statement

0:22:50 – IF Statement

0:23:50 – END=Option

0:30:05 – By-group processing method

0:42:00 – Duplicate or Non-duplicate observations

0:51:27 – Restructuring Data sets from Long to Wide Format

0:58:53 – Writing loops in the DATA Step

1:00:39 – Implicit Loops

1:03:17 – Explicit Loops

1:12:29 – Nested Loops

1:13:33 – Combining Implicit and Explicit Loops

1:14:55 – Array Processing

1:26:28 – Array Functions


Read the Paper



Related resources

How the SAS DATA Step Works: A Basic Introduction (documentation)

SAS Programming Community (online support community)



Version history
Last update:
‎08-04-2020 03:33 PM
Updated by:



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Tags