If you put %unquote() around a macro variable, that macro variable would be displayed or interpreted .
Therefore, macro variable &p_x would translate &dsn into 'class', check the following . that is to say %superq() doesn't make any sense.
You will see &p_x is already truncated in my code(check the bottom).
Actually, your code would look like this if you are using %unquote():
%let p_x = proc print data=sashelp.class; run;
the sas only know the first semicolon, and 'run;' is a validate statement in sas. so the line above is actually two line or code.
%let p_x = proc print data=sashelp.class;
run;
options nonotes nodate nonumber nosource nosymbolgen;
/* Source: Carpenter's Complete Guide to the SAS Macro Language (pp 133-134) */
/* The author's original code is slightly modified here */
%let dsn = class;
%let p = %nrstr(proc print data=sashelp.&dsn; run;);
%let p_x = %unquote(%nrstr(proc print data=sashelp.&dsn; run;));
%put The macro variable dsn contains the correct text: &=dsn;
%put The macro variable p=&p ;
%put The macro variable p contains the correct text: &=p;
%put The macro variable p_x=&p_x ;
%put The macro variable p_x contains the incorrect (?) text: %superq(p_x);
The macro variable dsn contains the correct text: DSN=class
The macro variable p=proc print data=sashelp.&dsn; run;
The macro variable p contains the correct text: P=proc print data=sashelp.&dsn; run;
The macro variable p_x=proc print data=sashelp.class
The macro variable p_x contains the incorrect (?) text: proc print data=sashelp.class
... View more