3

Sample Code :-

%Let a = begin;

%let b1 = %str(&a);

%let b2 = %nrstr(&a);

%let b3 = %bquote(&a);

%let b4 = %nrbquote(&a);

%let b = end;

Actual Output :-

b1 = begin 
b2 = &a 
b3 = begin 
b4 = begin

Expected Output :-

b3 = end     
b4 = &a

Is this because bquote and nrquote are execution time whereas str and nrstr are compile time ?

Robert Penridge
  • 8,424
  • 2
  • 34
  • 55
Rohit Gupta
  • 31
  • 1
  • 1
  • 2

1 Answers1

2

As explained in SAS manual http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#z3514quote.htm,

%QUOTE and %NRQUOTE mask the same items as %STR and %NRSTR, respectively. However, %STR and %NRSTR mask constant text instead of a resolved value. And, %STR and %NRSTR work when a macro compiles, while %QUOTE and %NRQUOTE work when a macro executes.

Kostya
  • 1,552
  • 1
  • 10
  • 16