Introduction to MACROS in SAS
- Using macros language, we can customize and reduce SAS language.
- Using macros language, we can develop reusable application.
- Macros language is character based language.
- If we want to develop macro application in SAS, we need 2 requirements
- Macro compiler or Processor
- Macro language
This is one of the part in SAS.
It can be used interact with macroprocessor.
It can be used to identify macrolanguage.
This is called macro reference Each and every macro statement starts with %.
This is called macrovariable reference. It can be used for reporting macrovariable.
- Macro coding can be written outside and inside of the macroblock.
- Macro block starts with % macro and requires name of the macro and closed with % mend.
Desired to gain proficiency on SAS? Explore the blog post on SAS Training Online to become a pro in SAS.
% Macro <Macroname>;
SAS coding (include dataset block, proc block, open code)
we run the macro application, SAS do compilation and stores compilation coding in catalog. Catalog name same name of macro.
Macro Call: To call required macro for execution.
Syntax: % <Macroname>;
Eg: %macro print;
input pid age;
input pd drug &;
- Catalog defaults stores in work library.
Concepts In Macro Language:
- Macro variables creation
- Passing arguments to macros
- Macro quoting function
- Macro options.
- Macro expressions
- Macro interface functions.
For indepth knowledge on SAS, click on below