BookmarkSubscribeRSS Feed
1162
Calcite | Level 5
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?
3 REPLIES 3
Cynthia_sas
SAS Super FREQ
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
1162
Calcite | Level 5
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.
Cynthia_sas
SAS Super FREQ
Hi:
That's good. Glad it worked out.
cynthia

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 3 replies
  • 1610 views
  • 0 likes
  • 2 in conversation