BookmarkSubscribeRSS Feed
VD
Calcite | Level 5 VD
Calcite | Level 5

Hi,

I am using this statement to output a text to the EG HTML :

ODS HTML(ID=EGHTML) text= "...."

The number of characters in the text (including spaces) is 531. The output shows only the first 245 characters. I get a warning in the log that "The quoted string currently being processed has become more than 512 characters long.  You may have unbalanced quotation marks." I can suppress this by using the noquotelenmax option. But the output does not show the full text (531 characters). Is there an option to programmatically change the default number of characters?

Thanks.

6 REPLIES 6
Cynthia_sas
SAS Super FREQ

Hi:

  Look at the attached screenshots. I wrote 647 characters to ODS HTML using the program below. The default output for EG is SASREPORT (not HTML) -- so, I also changed my Results to generate HTML. Did you change EG to create HTML output?

  I have written quite large strings to ODS HTML using ODS TEXT=, the largest was over 1000 characters. But I believe the max limit was something close to 4000 characters -- you could check with Tech Support.

  I think you should open a track with Tech Support to investigate what is going on with your particular program.

cynthia


eg_results_options.pngEGprogram.pngEG_TEXT.png
VD
Calcite | Level 5 VD
Calcite | Level 5


Cynthia,

Thank you for your reply.

Yes, I have changed the output to html in EG.

My string is of the following format. I tried it by using the code you have provided.


proc print data=sashelp.class (obs=2); run;

%let str2=%str(aaaaaaaaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbb, bbbbbbb - c.e. fffffffffffffffffffffffff. ggg g'h hhhh. iiiiiiiiiiiiiiiiii. Jjjjjjjjjjj. kkkkk, llllllll, mmmm.);

ODS text="&str2";

Also tried with ODS html text. I do not get any result or an error message. It just keeps on running. Not sure if it was required but I also tried masking the special characters in the string. That didn't work either.

Vikas

Cynthia_sas
SAS Super FREQ

Hi:

  I am not sure what you mean by "masking special characters" -- the only characters that need to be masked with %nrstr are & and % -- do those characters exist in your string? Other characters that may need to be preceded with a % are unmatched single quotes or unmatched parentheses.

  I would recommend that you work with Tech Support. Otherwise, if you do not wish to work with Tech Support, I'd recommend running with a few words at a time in ODS TEXT until you find the punctuation or unmatched ' or unmatched ) that might be causing your problem.

  BTW, ODS TEXT= writes to any open destination -- this was implemented in SAS 9 so that you did NOT need to know the destination name for the ODS TEXT statement. The only difference between ODS HTML TEXT= (needing the destination name) and ODS TEXT= is that in earlier versions of SAS (like SAS 8), the destination was required. The statements work the same way. So you may as well stick with ODS TEXT=. That is not the problem. The problem is probably in the text string that you are sending via ODS TEXT. I'm guessing that you have some issue caused by mismatched quotes or other stray punctuation. The macro documentation contains a list of all the characters that you need to watch out for.

cynthia

VD
Calcite | Level 5 VD
Calcite | Level 5

Many thanks for your detailed explanation. I will see if I can get ODS TEXT to work else will talk to tech support.


ballardw
Super User

Your specific example contains an unmatched single quote.

From online help:

If the argument to %STR or %NRSTR contains an unmatched single or double quotation mark or an unmatched open or close parenthesis, precede each of these characters with a % sign.

This is likely why you get no result. It is waiting for you to complete the assignment to STR2.

If this is typical of your constructs you may need a different macro quoting function if you need to build a macro variable.

Also, unfortunately ODS TEXT output seems to only appear after you run a proc or close an ODS output and won't always appear in a result window;

Change the path to something you would prefer.

ods rtf file='C:\junk.rtf';

ODS text="aaaaaaaaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbb, bbbbbbb - c.e. fffffffffffffffffffffffff. ggg g'h hhhh. iiiiiiiiiiiiiiiiii. Jjjjjjjjjjj. kkkkk, llllllll, mmmm.";

ods rtf close;

I have made very long statements using the above. If you put a line break in the editor you likely will need a leading space on the second or subsequent lines.

VD
Calcite | Level 5 VD
Calcite | Level 5

Ok great, thanks.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 6 replies
  • 2461 views
  • 4 likes
  • 3 in conversation