Group Discounts available for 3+ students and Corporate Clients

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

  1. Macro compiler or Processor
  2. Macro language



This is one of the part in SAS.



It can be used interact with macroprocessor.


Macrotiggers (%,&):

It can be used to identify macrolanguage.


Percentage (%):

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)

% Mend;

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;

proc print;


% mend;

data demo;

input pid age;


100   89

101   90


% print;

data medi;

input pd drug &;


100   5mg

101   6mg


% print;

– 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

“At TekSlate, we are trying to create high quality tutorials and articles, if you think any information is incorrect or want to add anything to the article, please feel free to get in touch with us at, we will update the article in 24 hours.”

0 Responses on Introduction to MACROS in SAS"

Leave a Message

Your email address will not be published. Required fields are marked *


Please Enter Your Details and Query.
Three + 6