The SAS Output Delivery System and reporting techniques

Reporting with Long Text Strings

Reply
Frequent Contributor
Posts: 95

Reporting with Long Text Strings

I am trying to create a report from a questionnaire. I'd like to put the question first, followed by each answer and the number and percent for each answer. The table should look something like this:

[pre]
What state did you live in when you went to high school?

Alabama 5 10%
New York 10 20%
California 35 70%
[/pre]

My problem is this. Some of the questions are very long (up to 700 characters). I can't seem to figure out a way to print such long questions. The line statement in the report procedure seems to be limited to 256 characters. I'm trying to use standard text output that I will put into MS Word format, but I'm open to other solutions.

Any suggestions?
SAS Super FREQ
Posts: 8,868

Re: Reporting with Long Text Strings

Hi:
ODS RTF writes Rich Text Format command strings that can be rendered by Microsoft Word (since Microsoft wrote the RTF specifications).

You might consider using ODS to create your file. I would probably use PROC REPORT with a COMPUTE BEFORE the question number variable in order to write the long question text with a LINE statement.

I can imagine providing the long question text in a variety of ways -- either with a user defined format, with Macro variables or just as a big character variable that is in the COLUMN statement, but is a NOPRINT variable (so you can use it in the LINE statement, but not display it on every report row).

There are probably other ways to approach this problem, but I think the key to them all is to use ODS RTF directly, instead of the LISTING destination. That's because ODS destinations (HTML, RTF, PDF) do not have the 256 linesize limitation that the LISTING destination has.

If you are not familiar with PROC REPORT or with ODS, you might consider contacting Tech Support for more help with your particular report needs.
cynthia
Frequent Contributor
Posts: 95

Re: Reporting with Long Text Strings

Posted in reply to Cynthia_sas
Thanks.

I was using proc report with the line statement, but I was writing the file using proc printto which I now think is the cause of my truncated question as you mentioned. I switched to ODS HTML and got much better results.
SAS Super FREQ
Posts: 8,868

Re: Reporting with Long Text Strings

Hi:
That's good. Glad it worked out.
cynthia
Ask a Question
Discussion stats
  • 3 replies
  • 165 views
  • 0 likes
  • 2 in conversation