Hi Bruce -
I would suggest the following instead:
file "temp.sas" lrecl=32767;
length text $32767;
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.
"Bruce Bradbury" <BruceBrad@iname.com> wrote in message
> 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
> 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;
> 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).