call macro present in another SAS code

Today, I will discuss about How to call macro whose code is present in another SAS script. First, we need to understand why another SAS script is required. Answer to this is very simple that is redundant code. Many a times, particular portion of code is used in many SAS scripts like getting today’s date or yesterday’s date or yesterday’s month or year. For this , It is recommended to write a separate code and call that code in the existing script.
Here, I have created two SAS Scripts.


In the First Script, I have included another SAS code and then calling macro which is defined in that SAS code.
In the Second Script, definition of macro is present where we are just printing Today’s date.

You can this design of calling another SAS script in the existing SAS script using Macro if you think that portion of code can be used or referenced by other modules as well.

Related posts