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-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!

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
  • 1334 views
  • 0 likes
  • 2 in conversation