• USA : +1 973 910 5725
  • INDIA: +91 905 291 3388
  • info@tekslate.com
  • Login

Introduction to MACROS in SAS

MACROS

– 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

 

Macroprocessor:

This is one of the part in SAS.

 

Macrolangauge:

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 %.

 

Ampson(&):

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.

Syntax:

% 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;

run;

% mend;

data demo;

input pid age;

cards;

100   89

101   90

;

% print;

data medi;

input pd drug &;

cards;

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

Summary
Review Date
Reviewed Item
Introduction to MACROS in SAS
Author Rating
4

“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 info@tekslate.com, 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 *

    Site Disclaimer, Copyright © 2016 - All Rights Reserved.

    Support


    Please leave a message and we'll get back to you soon.

    I agree to be contacted via e-mail.