Help using Base SAS procedures

How to solve 'Quoted string is too long'

Reply
New Contributor
Posts: 4

How to solve 'Quoted string is too long'

How to solve the following problem when I use Proc Format? Thank you so much!

WARNING 32-169: The quoted string currently being processed has become more than 262 characters long. You may have unbalanced quotation marks.

ERROR 180-322: Statement is not valid or it is used out of proper order.
Super User
Posts: 5,429

Re: How to solve 'Quoted string is too long'

Please share your proc format code, it's easier to help then.

/Linus
Data never sleeps
New Contributor
Posts: 4

Re: How to solve 'Quoted string is too long'

Thanks! Here is the code.

proc format;
value $fmace;
'lace'="Hold Event (Life-time, Mgh, Non-High-elective Cardiovascular
Surgery for Aphgrb,Stroke,^R'{\par}'Renal Failure,
Ventilation for Less than 55 hours,Ga-Fk Complication
^R'{\par}'Requiring Surgery, New Onset out of Permanent
Atrial Fibrillation,Sep,^R'{\par}'Transfusion
of 15 or More Unites of Blood)";
run;
Super Contributor
Posts: 394

Re: How to solve 'Quoted string is too long'

New Contributor
Posts: 4

Re: How to solve 'Quoted string is too long'

do not know how to use the option yet. Could you please give me an example? Thank you so mcuh!
Super Contributor
Super Contributor
Posts: 3,174

Re: How to solve 'Quoted string is too long'

Surround each of your "label value" lines with double-quotes. I ran your code with success when using the technique shown below, and also when using the SAS PROC FORMAT CNTLIN= technical approach where you build a suitabe SAS member with the variables required for PROC FORMAT, and your output format translation strings (the START and LABEL variables).

Scott Barry
SBBWorks, Inc.

proc format;
value $fmace
'lace' = "part 1, "
"part 2, "
"part 3, "
"part 4";
run;
New Contributor
Posts: 4

Re: How to solve 'Quoted string is too long'

Thanks a lot! But when I change my code to

proc format;
value $fmace;
lace'="Hold Event (Life-time, Mgh, Non-High-elective Cardiovascular "
"Surgery for Aphgrb,Stroke,^R'{\par}'Renal Failure, "
"Ventilation for Less than 55 hours,Ga-Fk Complication"
"R'{\par}'Requiring Surgery, New Onset out of Permanent "
"Atrial Fibrillation,Sep,^R'{\par}'Transfusion
"of 15 or More Unites of Blood)";
run;


The warning is gone, but there is an error in Log:
ERROR 180-322: Statement is not valid or it is used out of proper order.
Super Contributor
Super Contributor
Posts: 3,174

Re: How to solve 'Quoted string is too long'

Remove the first semi-colon for the VALUE statement -- it should not be there.

Scott Barry
SBBWorks, Inc.
Super Contributor
Posts: 394

Re: How to solve 'Quoted string is too long'

> do not know how to use the option yet. Could you
> please give me an example? Thank you so mcuh!

options noquotelenmax;
Super Contributor
Posts: 273

Re: How to solve 'Quoted string is too long'

0521, Are you satisfied now?
Going further i think you are falling into an ods rtf problem
[pre]
options noquotelenmax;
ods escapechar="^";
proc format;
proc format;
value $fmace
"lace" = 'Hold Event (Life-time, Mgh, Non-High-elective Cardiovascular Surgery for Aphgrb,Stroke,
^R/rtf "{\par} " Renal Failure,Ventilation for Less than 55 hours,Ga-Fk Complication
^R/rtf "{\par} " Requiring Surgery, New Onset out of Permanent Atrial Fibrillation,Sep,
^R/rtf "{\par} " Transfusion of 15 or More Unites of Blood)';
run;

proc format;
value $fmacc
"lace" = "Hold Event (Life-time, Mgh, Non-High-elective Cardiovascular "
"Surgery for Aphgrb,Stroke, ^n Renal Failure, "
"Ventilation for Less than 55 hours,Ga-Fk Complication"
" ^n Requiring Surgery, New Onset out of Permanent "
"Atrial Fibrillation,Sep,^n Transfusion"
"of 15 or More Unites of Blood)";
run;
data a;
v='lace';
run;


ods listing close;
ods rtf file="d:\test.rtf";
proc print;
format v $fmace.;
run;
ods rtf close;
ods listing;
[/pre]
the format $macc. is working well but not the $mace.!
Why ? i hope Cynthia will take a look at this 'ods question'.
I don't see why the ^R/rtf "{\par}" is appearing in the result!

Perhaps the use of {par} is inapplicable into a table cell?

Andre
SAS Super FREQ
Posts: 8,866

Re: How to solve 'Quoted string is too long'

Hi:
Others have given you excellent advice. The only thing I have to add is that generally, when you use RTF control strings or HTML tags in your code, you must turn off the protection of special characters in order for the special character to be passed to the destination without "protection" or encoding. This protection is the thing that turns an & into & -- for example.

In your case, since you are using proc print, you can turn off the protection of special characters like this:

[pre]
ods rtf ...;
proc print data=a;
var v / style(data)={protectspecialchars=off};
format v $fmace.;
run;
ods rtf close;
[/pre]

I'm not sure why you're using \par. My tendency would be to use \line. Although I don't know the RTF spec well enough to know whether you can put a \par in a table cell (I -think- you can.) I always find it better to go with the "low impact" control strings. \line doesn't have any side effects that I know about, but depending on the Word template that's being used when the document is opened in Word, \par could have unintended consequences.

cynthia
Ask a Question
Discussion stats
  • 10 replies
  • 442 views
  • 0 likes
  • 6 in conversation