Delimiting Macro Variable References

A Brief Overview

Tokens are delimited by spaces or special tokens by default. Sometimes when you use a macro variable reference in combination with other text, the reference does not resolve as you expect if you simply concatenate it. Instead, you might need to delimit the reference by adding a period to the end of it.
A period immediately following a macro variable reference acts as a delimiter. That is, a period at the end of a reference forces the macro processor to recognize the end of the reference. The period does not appear in the resulting text.

Example: Using a Delimiter to Reference Macro Variables

The following example illustrates using a delimiter, a period (.), between the libref and the table name to reference the macro variable.
%let CarType=Wagon;
%let lib=sashelp;
title "&CarType.s from the &lib..CARS Table";
proc freq data=&lib..cars;
   tables Origin/nocum;
   where Type="&CarType";
run;
proc print data=&lib..cars;
  var Make Model Type MSRP;
  where Type="&CarType";
run;
Note: When the character following a macro variable reference is a period, use two periods. The first is the delimiter for the macro reference, and the second is part of the text.
Output 7.3 PROC FREQ Output
PROC FREQ Output
Output 7.4 PROC PRINT Output
PROC PRINT Output
Last updated: October 16, 2019
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset