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

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…

Contents