LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (February 2008, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Fri, 8 Feb 2008 09:25:12 -0500
Reply-To:   "Xiao, Steven" <sxiao@SFWMD.GOV>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Xiao, Steven" <sxiao@SFWMD.GOV>
Subject:   %STR related help needed.
Content-Type:   text/plain; charset="us-ascii"

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


Back to: Top of message | Previous page | Main SAS-L page