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 - 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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
The CORR and FREQ procedures4m 47s
-
(Locked)
The MEANS and UNIVARIATE procedures3m 22s
-
(Locked)
Demo: Ames home sales data exploration4m 15s
-
(Locked)
Selecting output to print and suppress2m 45s
-
(Locked)
Demo: Selecting output with ODS TRACE or the online documentation3m 45s
-
(Locked)
Saving results to new SAS data sets2m 22s
-
(Locked)
Demo: Creating data tables with ODS6m 9s
-
(Locked)
Creating global macro variables: Manually6m 35s
-
(Locked)
Creating global macro variables: Automating the process3m 26s
-
(Locked)
Demo: Creating and using macro variables6m 42s
-
(Locked)
Macro programming3m 56s
-
(Locked)
Creating macro programs with parameters5m 9s
-
(Locked)
Creating macro programs with macro statements: A business example4m 28s
-
(Locked)
Demo: A macro program to generate data, summary statistics, and plots6m 46s
-
(Locked)
Demo: A macro program for iterative processing8m 37s
-