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 macro programs with parameters - SAS Tutorial
From the course: SAS Programming for R Users, Part 2
Creating macro programs with parameters
- [Narrator] Now just like in R, we can pass macro a parameter list to customize the program even further. And just like in R we can use positional keyword or a mixture of those parameter lists. Now in R you probably don't know the exact names. You've probably just bypassed that part, but in SAS there's just little bit more structure so we need to be a little bit more aware of what position and keyword parameter is. So here I'm creating a macro called calc, and you'll notice it's just the mean's procedure. And I have two positional parameters, a dsn, for data set name, separated by comma, and vars, for the variables that I'm going to put in my var statement. And you'll notice when I pass in those parameters I'm passing them in as if they are macro variables. So I'm tacking on an ampersand to dsn and vars in the means procedure. So when I go ahead and call the macro with %calc, I'll simply list the data set name, in this case, business, and the variables, in this case, just yield. Why…
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
-