From the course: SAS Programming for R Users, Part 2

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Demo: A macro program for iterative processing

Demo: A macro program for iterative processing - SAS Tutorial

From the course: SAS Programming for R Users, Part 2

Demo: A macro program for iterative processing

- [Instructor] In this demonstration, I want to use a macro program for iterative processing. So, imagine I have 10 separate CSV files that I want to read in separately, and then I want to stack those data sets on top of each other. I can use a macro to make this process extremely simple. So, imagine the 10 CSVs that you're going to read in have the same structure. Each CSV has three variables, the stored number, which is one through 15, the year, in this case, 2000, and the sales the store generated. And each CSV is going to be called, sales_ followed by the year pertaining to the sale. So in this case, I have sales_2000, the next CSV file, the sales_2001, and so on. So, I want to read in all 10 of these data sets and stack the data into a single SAS data set. I'm going to call this macro, myappend, because I'm going to be reading in CSVs iteratively and appending them to a single SAS data set. And this is going to have two positional parameters, start and stop. I'll start with a %do…

Contents