BookmarkSubscribeRSS Feed
0521
Calcite | Level 5
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.
10 REPLIES 10
LinusH
Tourmaline | Level 20
Please share your proc format code, it's easier to help then.

/Linus
Data never sleeps
0521
Calcite | Level 5
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;
0521
Calcite | Level 5
do not know how to use the option yet. Could you please give me an example? Thank you so mcuh!
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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;
0521
Calcite | Level 5
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.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Remove the first semi-colon for the VALUE statement -- it should not be there.

Scott Barry
SBBWorks, Inc.
Tim_SAS
Barite | Level 11
> do not know how to use the option yet. Could you
> please give me an example? Thank you so mcuh!

options noquotelenmax;
Andre
Obsidian | Level 7
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
Cynthia_sas
SAS Super FREQ
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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 10 replies
  • 3100 views
  • 0 likes
  • 6 in conversation