Creating Data-Driven Macro Variables with PROC SQL

A SAS macro variable stores text that is substituted in your code when SAS runs the program. Macro variable execution is similar to an automatic find-and-replace. Macro variables are temporary, and they are stored in-memory, so when you exit SAS, they are deleted. However, you can create data-driven macro variables with a PROC SQL query and then use those macro variables in your SAS program, procedure, and DATA step.

Creating Data-Driven Macro Variables with the INTO Clause

The INTO Clause

You can access the macro facility in a PROC SQL step by using the INTO clause in the SELECT statement. The various forms of the INTO clause can perform a variety of functions. For example, you can create ...

Get SAS Certified Professional Prep Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.