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: Creating and using macro variables - SAS Tutorial
From the course: SAS Programming for R Users, Part 2
Demo: Creating and using macro variables
- [Instructor] Let's see how to create and use macro variables. In the first part, I'm going to show you how to automate the process. So, first, I need to create a new SAS dataset. I'm going to use the means procedure on the Ames Housing dataset, and I'll analyze the sale price variable. I'll use the output statement to save a new SAS dataset with the out equal to option, and I'll save the dataset called stats, and I want to save the mean and standard deviation under the variable names S-P underscore mean, S-P underscore S-D. Once I create that dataset, I'm going to go ahead and query it with proc SQL, and create new global macro variables. So I'm going to select the variable name, S-P underscore mean, and I'll put it into a new macro variable, with the colon operator S-P underscore mean. Yes, these are the same names. One is a variable name, and one is my new macro variable name. And of course, this is from the stats dataset I've just made. Likewise, I'm going to select S-P…
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
-