@GN0001 wrote:
Hello team, why we are using %include in sas?
What are the options if we don’t want to use it?
If you don't want to use it, you can set up an AUTOCALL library of macros (if you are talking about macros, you don't really say) and then you don't have to use %include each time you want to use a macro.
And if your %include doesn't call in a macro, you could make it a macro.
Please see this thread for more details on the benefits of AUTOCALL compared to %include
https://communities.sas.com/t5/SAS-Programming/SAS-Macro-Help-Text-Documentation/m-p/753876#M237672
%include is used to submit code stored in an external file.
Why? Many reasons are possible. One is that the code has been well debugged and doesn't need changes. So move to an external file so your current editor window isn't clogged up. Another just plain log code that doesn't change such as a bunch of format definitions.
Another use so that multiple users can access the code in the same file and inherit any changes made without rewriting code (cautions apply to other dependencies).
@GN0001 wrote:
Thanks fir the response. Is it recommended to use?
Blueblue
If the examples I provided, or similar ideas, apply then yes. %include is a very mature tool been around in SAS coding since at least the 1980's.
@GN0001 wrote:
Thanks fir the response. Is it recommended to use?
Blueblue
Any supported feature of SAS (and this is supported) is "recommended to use".
Whether or not it is a good idea to use it, or whether or not there are easier ways to do what you want, depends on a lot of things, including your situation and reason for using %include, which you have not explained.
Why we are using %include in sas?
To read in and run SAS code stored in another program file into the program with the %include statement.
What are the options if we don’t want to use it?
Copy the code that is in the other program and add it to the current program. The downside is you end up duplicating code all over your programs creating a potential maintenance problem.
@GN0001 wrote:
Hello team, why we are using %include in sas?
What are the options if we don’t want to use it?
If you don't want to use it, you can set up an AUTOCALL library of macros (if you are talking about macros, you don't really say) and then you don't have to use %include each time you want to use a macro.
And if your %include doesn't call in a macro, you could make it a macro.
Please see this thread for more details on the benefits of AUTOCALL compared to %include
https://communities.sas.com/t5/SAS-Programming/SAS-Macro-Help-Text-Documentation/m-p/753876#M237672
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.