The SAS Output Delivery System and reporting techniques

Wrapping variables to multiple lines with Proc Report

Reply
N/A
Posts: 0

Wrapping variables to multiple lines with Proc Report

All:

I have an issue with wrapping a variable to the next line. I was in an impression that a flow statement given for any variable in the define step, would wrap the respective variable properly to the number of lines. But, when I was working with the following piece of code, I felt, there must be something other than FLOW, which controls wrapping in proc report. Could someone suggest me, if there is a solution for this, or if I have done some mistake in the code?

data test;
set sashelp.class;
tempname=trim(left(name))||' is a*good guy';
run;

proc report data=test split='*' headskip headline;
columns tempname;
define tempname / flow group width=7;
break after tempname/skip;
run;

With this code, I expected the output to be something like the left one, but ended up with an output like the right one:


tempnam.................................tempnam
e.............................................e
-------........................................-------

Alfred......................................Alfred
is a.........................................is a
good.......................................good
guy.........................................guy

Alice.......................................Alice i
is a.........................................s a
good.......................................good
guy.........................................guy

Barbara...................................Barbara
is a.........................................is a
good.......................................good
guy.........................................guy

Carol.......................................Carol i
is a.........................................s a
good.......................................good
guy.........................................guy

Henry......................................Henry i
is a.........................................s a
good.......................................good
guy.........................................guy
.....................................................................

My question is, why is 'is' being splitted, though there is no split character or a blank space in between?

Thanks in Advance,
Hemanth.
Super Contributor
Posts: 394

Re: Wrapping variables to multiple lines with Proc Report

Posted in reply to deleted_user
(Good test program, hemanth. You made it easy for me to figure out what was going on!)

If you try your test without the "*" in the data, that is " is a good guy" instead of " is a*good guy", you'll get the output you expect.

The FLOW documentation says "The FLOW option honors the split character. If the text contains no split character, then PROC REPORT tries to split text at a blank." What is doesn't say (but possibly should) is that when the text contains an explicit split character then PROC REPORT does not use blanks as implicit split characters.

In the text "Alice is a*good guy" there are 10 characters preceding the split character, so PROC REPORT simply splits after the first 7.
N/A
Posts: 0

Re: Wrapping variables to multiple lines with Proc Report

Hi Tim,

Thanks for the reply. Is there a way to avoid this? Meaning, I want to use a split character, and I also want to split the line whenever a space is reached (instead of truncating the word), whichever comes first. Is there a way to get the desired result?

Thanks,
Hemanth.
Super Contributor
Posts: 394

Re: Wrapping variables to multiple lines with Proc Report

Posted in reply to deleted_user
Sorry, no.
Ask a Question
Discussion stats
  • 3 replies
  • 132 views
  • 0 likes
  • 2 in conversation