The SAS Output Delivery System and reporting techniques

ods text length

Reply
Frequent Contributor
Frequent Contributor
Posts: 94

ods text length

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.

SAS Super FREQ
Posts: 8,716

Re: ods text length

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

Attachment
Attachment
Attachment
Frequent Contributor
Frequent Contributor
Posts: 94

Re: ods text length


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

SAS Super FREQ
Posts: 8,716

Re: ods text length

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

Frequent Contributor
Frequent Contributor
Posts: 94

Re: ods text length

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


Grand Advisor
Posts: 10,192

Re: ods text length

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.

Frequent Contributor
Frequent Contributor
Posts: 94

Re: ods text length

Ok great, thanks.

Ask a Question
Discussion stats
  • 6 replies
  • 684 views
  • 4 likes
  • 3 in conversation