BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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.
3 REPLIES 3
Tim_SAS
Barite | Level 11
(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.
deleted_user
Not applicable
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.

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