DATA Step, Macro, Functions and more

Difference in BASE sas & Macros?

Reply
Regular Learner
Posts: 1

Difference in BASE sas & Macros?

What are the different operations or procedures which can be used in Base SAS but not Macros and Viceversa?

Super User
Posts: 3,108

Re: Difference in BASE sas & Macros?

There is no difference. SAS macros are mainly used as code generation tools and must produce correct Base SAS code, the same as if you had done it without macros.

 

Note macros can be used to generate any SAS code not just Base SAS.

Super User
Posts: 6,939

Re: Difference in BASE sas & Macros?

Misunderstanding of concepts here.

 

The macro language in SAS is a preprocessing language. It is designed to let a programmer create dynamic Base SAS code.

The macro language has its own elements that have a resemblance to elements of the data step language (for ease of use), but it does something completely different. The data step language deals with data, the macro language deals with code as its output.

 

You cannot use a procedure in the macro language, you create the code for it with macro language.

 

PS Certain interfaces exist that allow the macro language to use data step functions (%sysfunc) and the data step language to work with macro variables (sysget and call symput).

 

 

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Super User
Super User
Posts: 7,401

Re: Difference in BASE sas & Macros?

Actually: "the macro language deals with code as its output." - the macro pre-processor only deals with text.  If that is code all well an good, but it doesn't necessarily have to be.  All the macro language is a text generator, true it has some funky loops and things, but ultimately it just generates a string.

Super User
Posts: 6,939

Re: Difference in BASE sas & Macros?

@RW9 yeah, right, but I wanted to avoid that some newbie then tries to manipulate strings contained in datasets with macro language. Young padawans come up with all kinds of crazy ideas concerning the macro language, as we all know.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Ask a Question
Discussion stats
  • 4 replies
  • 97 views
  • 3 likes
  • 4 in conversation