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.
Creating global macro variables: Automating the process - SAS Tutorial
From the course: SAS Programming for R Users, Part 2
Creating global macro variables: Automating the process
- [Narrator] So we just saw how to create macro-variables manually with the %less statement, and now let's automate the process using SQL. Well, step one, in order to query a data set, we need to actually have data set with useful information, so in this case I'm running the means procedure using the output statement to create a new SAS data set with the values for mean and standard deviation. So the variable names in this data set stats are going to be mean and SD. Now I can go ahead and query that data and create new macro-variables. To do so, I'll use PROC SQL and I'll start with the select statement, and specify the variable name in my data set, in this case, mean. I'll use the keyword 'into' and the colon operator and specify a new macro-variable that I'm creating, sp_mean. And finally I need to tell it what data set I'm looking into from stats. And likewise, I'm going to select the standard deviation and put that into a new macro-variable called sp_sd, again from the stats data…
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
-