SAS_Macro[1] - MACROLANGUAGE 1 MacroFacility ustousemacros SASsy

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
  1 MACRO LANGUAGE MACRO LANGUAGE
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
  2 Macro Facility - Macro Facility -     The SAS macro facility is a tool within Base SAS  software that contains the essential elements that enable  us to use macros.    The macro facility contains a macro processor that  translates macro code into statements that is used by the  SAS system, and the macro language.       INTRODUCTION TO MACROS INTRODUCTION TO MACROS
Background image of page 2
  3 Macro Facility - Macro Facility -    Macro language provides the means to communicate  with the macro processor.    Macro language consists of its own set of commands,  options, syntax and compiler.       INTRODUCTION TO MACROS INTRODUCTION TO MACROS
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
  4 Macro Language Tools - Macro Language Tools -    Macro language provides tools that     Pass information between SAS steps.    Dynamically create code at execution time.    Conditionally execute DATA or PROC steps.    Create generalized and flexible code.       INTRODUCTION TO MACROS INTRODUCTION TO MACROS
Background image of page 4
  5       INTRODUCTION TO MACROS` INTRODUCTION TO MACROS` Defining A Macro - Defining A Macro - Any macro code should be with in the two macro  language statements  %Macro  and  %Mend . Syntax  : -    %Macro  macro-name; - - - - Macro - - text;          %Mend  <macro-name>; Note :-  No macro name can begin with ‘ sys ’ or the name of a SAS         supplied macro statement  or a macro function.
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
  6 SAS Code       INTRODUCTION TO MACROS INTRODUCTION TO MACROS Example Example %Macro  Print; dname ; dname "; Run;  %Mend  Print; Note: To resolve macro variable in a macro, use double quote Proc Print Data=Sample; Title ‘The Data Set Name Sample’; Run; Macro Code ->
Background image of page 6
  7       INTRODUCTION TO MACROS INTRODUCTION TO MACROS Macros are called by placing a (%) before the macro  name.  Example:-          %Macro  Sort;                 Proc Sort Data=&dname;                 By &var1;        Run;        %Mend  Sort;          %Let dname=First;           %Let var1=duns;               %Sort ;              Calling A Macro - Calling A Macro -
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
  8 Defining Macro Variables Defining Macro Variables    Macro variables are also known as symbolic  variables.   Macro variables are  not dataset variables but they  belong to SAS macro language.   Once a macro variable is defined it can take any 
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/08/2010 for the course USE 3425 taught by Professor Raman during the Spring '10 term at Punjab Engineering College.

Page1 / 40

SAS_Macro[1] - MACROLANGUAGE 1 MacroFacility ustousemacros SASsy

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online