DYNAMIC, MVAR, and NMVAR Statements

Each of the DYNAMIC, MVAR, and NMVAR statements can define multiple variables and an optional text-string denoting its purpose or usage. For example:
DYNAMIC YVAR "required" YLABEL "optional"; 
MVAR LOCATE "INSIDE or OUTSIDE" SYSDATE;
NMVAR TRANS "transparency factor";
Note: For template readability, it is helpful to adopt a naming convention for these variables to distinguish them from actual option values or column names. Common conventions include capitalization, or adding leading or trailing underscores to their names.
Dynamics and macro variables can be referenced within the template definition as
  • argument or option values. For example:
    seriesplot x=date y=YVAR / curvelabel=YLABEL  
      curvelabellocation=LOCATE datatransparency=TRANS;
      
  • parts of some text strings. For example:
    entrytitle "Time Series for " YLABEL; 
    entryfootnote "Created on " SYSDATE;
    
Dynamics and run-time macro variable references cannot resolve to statement or option keywords.
Note that macro variable references should not be prefaced with an ampersand (&) if you want them to resolve at run time.
Macro variables defined by MVAR are strings when they resolve, as with SYMGET() in the DATA step.
Macro variables defined by NMVAR are converted to numeric tokens when they resolve, as with SYMGETN() in the DATA step.