Search notes:

SAS programming - macro statement: %let

%let creates a macro variable. The value of the macro variable is stored in the macro table.
Before the value of the macro variable goes into the symbol table, macro triggers (& and % are resolved or executed). That is macro functions (like %upcase or %substr) are evaluated first.
/* 
    %let creates a macro variable and assigns a
    value to it.
    
    The macro variable is then resolved by putting an
    ampersand in its front.
*/

%let   answer=forty-two;
%put  &answer;
%put '&answer'   /* Within '...', the macro variable is not expanded */;
%put "&answer"   /* Within "...", the macro variable is expanded     */;

/* Note that the "&variable" construct turns the datatyp into CHAR: */
%let tq84_num=42;
%put %datatyp( &tq84_num ); /* NUMERIC */
%put %datatyp("&tq84_num"); /* CHAR    */
Github repository about-SAS, path: /macro-processor/statements/let.sas

See also

macro statements

Index