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 (March 2004, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Sat, 6 Mar 2004 02:49:30 -0600
Reply-To:   Kevin Myers <KevinMyers@AUSTIN.RR.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Kevin Myers <KevinMyers@AUSTIN.RR.COM>
Organization:   Posted via Supernews, http://www.supernews.com
Subject:   Re: Macro quoting and quoted string length

Hi Bruce -

I would suggest the following instead:

data _null_; file "temp.sas" lrecl=32767; length text $32767; text=symget("codetext"); put text; run;

This approach will eliminate all of your quoting headaches. Note there is also no need for your file log statement unless your own code in this data step is actually writing messages directly to the SAS log.

s/KAM

"Bruce Bradbury" <BruceBrad@iname.com> wrote in message news:f0bde881.0403052321.2f14e59b@posting.google.com... > I am writing a SAS program which builds some more SAS code. Currently > I have a structure like this > > 1. Assemble a (long) macro variable which includes SAS code > statements. > 2. Write these out to a temporary file. > 3. Read the temporary file back in with an %include statement to > execute the code. > > I am having some problems with step 2. I currently have code like > > data _null_; > file "temp.sas" lrecl=10000; > put "%bquote(&codetext)"; > file log; > run; > > My first question is: is %bquote the correct quoting function here? > The codetext macro variable can in principal include any text that can > occur in SAS code. > > My second question is: Sometime when I run this, I get a warning > message saying my quoted string is too long and I may have unbalance > quotation marks. I think this is occurring when the codetext macro > variable is long (over 260 or so bytes). That is, I _am_ trying to > quote a very long string. Can I simply ignore this warning message? Is > there a better way? > > (PS the reason that I'm writing to a temporary file rather than simply > using the macro variable is that I iterate this process and the code > can grow to >64kB).


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