|
SAS-L gurus -
I have a confusion about %str(), which has been a headache to me for
long long time. The following code explains what happened and need your
guys help.
******************* EXAMPLE CODE *****************
data okk;
set interval_15min_plot(firstobs=1 obs=10);
call symput ('dtm',compress(put(dt,datetime18.))); /* assume
variable "dt" is a datetime variable*/
run;
%put dtm=&dtm; /* output of it is 13JAN05:02:30:00 */
%macro test(dtm);
data okk1;
set okk (where=(dt le &dtm));
run;
quit;
%mend test;
%test(&dtm); /* errors show that "(where=(dt le &dtm))" has problems */
%let dtm1=%str(%')&dtm%str(%'dt);
%test(&dtm1); /* errors show that "(where=(dt le &dtm))" has problems */
%test('13JAN05:02:30:00'dt); /* this is correct */
************* EXAMPLe CODE DONE *****************
My question is why macro "dtm1" is not equivalent to
'13JAN05:02:30:00'dt? I used %str(%') trying to generate same quote
"'"
Detailed error from SAS log is
SYMBOLGEN: Macro variable DTM resolves to '13JAN05:02:30:00'dt
SYMBOLGEN: Some characters in the above value which were subject to
macro quoting have been
unquoted for printing.
Thanks for help
Steven
|