If you're copying and pasting code over and over to perform the same operation on multiple variables in a SAS DATA step, you need to learn about arrays and DO loops. Arrays and DO loops are efficient and powerful data manipulation tools that belong in your programmer’s toolbox. In this 20-minute workshop, you'll learn how to create an array and use DO loops to perform operations on the elements in an array, create new variables, and change a short and wide data structure to a long and skinny one.
00:40 - What is an array?
01:22 - What is a DO loop?
04:47 - Syntax of an array
05:34 - For indexed array, indicate number of elements in curly brackets
05:49 - Character variables? Designate array with dollar sign
06:00 - Other options for variables
08:12 - Start with array statement, end with semicolon
11:46 - How to reference an array in an interative DO loop or indexed DO loop
15:19 - Example of a do-over loop with a non-indexed array
How to Restructure Your Data Using Arrays and DO Loops (YouTube tutorial)
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.
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.