Date: Tue, 13 Apr 2004 16:44:34 +0200
Reply-To: "Groeneveld, Jim" <jim.groeneveld@VITATRON.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Groeneveld, Jim" <jim.groeneveld@VITATRON.COM>
Subject: Re: PROC REPORT: wrapping of column values
Content-Type: text/plain; charset="iso-8859-1"
Hi Robert,
Thanks, that is indeed about what I wanted. I have extended your example to show what I wanted more: both automatically wrapped variable labels and character values of V2 or formatted values of v0.
======================================================================
proc format;
value _longfmt
1 = "this is the value 1 label"
2 = "this is the value 2 label"
3 = "this is the value 3 label"
4 = "this is the value 4 label"
;
run;
data jim;
infile cards;
input v0 v1 v2 $char10. +1 v3 $char10.;
label v0 = "This is the v0 label"
v1 = "This is the v1 label"
v2 = "This is the v2 label"
v3 = "This is the v3 label"
;
cards;
1 2004 my data any string
2 2004 your data any string
3 2004 his data any string
4 2004 everybodys any string
;
run;
proc report data=jim nowd;
columns v0 v1 v2 v3;
define v0 / across width=5 right flow order=internal format=_longfmt.;
define v1 / group left flow;
define v2 / across width=5 center flow order=data;
define v3 / display width=6 center flow;
run;
======================================================================
And to my great surprise all that worked! So I have to review my rather complicated macro code (partly stored in macro variables) to see what it likes and to change it into what I want it does.........
In the meantime I have done so and I will present now a situation, where the wrapping does not take place automatically, even with explicit SPLIT=' ':
======================================================================
proc format;
value _longfmt
1 = "this is the value 1 label"
2 = "this is the value 2 label"
3 = "this is the value 3 label"
4 = "this is the value 4 label"
;
run;
data jim;
infile cards;
input v0 v1 v4 v5;
label v0 = "This is the v0 label"
v1 = "This is the v1 label"
;
cards;
1 2004 11 22
2 2004 33 44
3 2004 55 66
4 2004 77 88
;
run;
PROC REPORT DATA=Jim LS=80 PS=63 HEADLINE HEADSKIP CENTER MISSING SPLIT=' ';
COLUMN ( (
"_______________________________________________________________________________________________
_" " " v1 v0,("__" " " v4 v5 ) ) );
DEFINE v1 / GROUP FORMAT= 5. WIDTH=16 SPACING=0 FLOW LEFT ORDER=INTERNAL
"This is the v1 label" ;
DEFINE v0 / ACROSS FORMAT=_longfmt. WIDTH=16 SPACING=1 FLOW CENTER ORDER=INTERNAL
"This is the v0 label" "--" " " ;
DEFINE v4 / SUM WIDTH=5 FLOW FORMAT= 5.0 SPACING=1 RIGHT "Vfour";
DEFINE v5 / SUM WIDTH=5 FLOW FORMAT= 5.1 SPACING=1 RIGHT "Vfive";
RUN;
======================================================================
If instead of that code the following code is run, where the value labels, the formatted values actually, have obtained a slash where there were spaces and where the SPLIT character was set to '/', the values wrap as desired, but that is not automatic; I had to insert the slashes:
======================================================================
proc format;
value _longfmt
1 = "this/is/the/value/1/label"
2 = "this/is/the/value/2/label"
3 = "this/is/the/value/3/label"
4 = "this/is/the/value/4/label"
;
run;
data jim;
infile cards;
input v0 v1 v4 v5;
label v0 = "This is the v0 label"
v1 = "This is the v1 label"
;
cards;
1 2004 11 22
2 2004 33 44
3 2004 55 66
4 2004 77 88
;
run;
PROC REPORT DATA=Jim LS=80 PS=63 HEADLINE HEADSKIP CENTER MISSING SPLIT='/';
COLUMN ( (
"_______________________________________________________________________________________________
_" " " v1 v0,("__" " " v4 v5 ) ) );
DEFINE v1 / GROUP FORMAT= 5. WIDTH=16 SPACING=0 FLOW LEFT ORDER=INTERNAL
"This is the v1 label" ;
DEFINE v0 / ACROSS FORMAT=_longfmt. WIDTH=16 SPACING=1 FLOW CENTER ORDER=INTERNAL
"This is the v0 label" "--" " " ;
DEFINE v4 / SUM WIDTH=5 FLOW FORMAT= 5.0 SPACING=1 RIGHT "Vfour";
DEFINE v5 / SUM WIDTH=5 FLOW FORMAT= 5.1 SPACING=1 RIGHT "Vfive";
RUN;
======================================================================
If you run both last examples you can see the difference and what I mean.
Regards - Jim.
--
. . . . . . . . . . . . . . . .
Jim Groeneveld, MSc.
Biostatistician
Science Team
Vitatron B.V.
Meander 1051
6825 MJ Arnhem
Tel: +31/0 26 376 7365
Fax: +31/0 26 376 7305
Jim.Groeneveld@Vitatron.com
www.vitatron.com
My computer remains home, but I will attend SUGI 2004.
[common disclaimer]
-----Original Message-----
From: Robert Bardos [mailto:bardos2@ANSYS.CH]
Sent: Sunday, April 11, 2004 11:29
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: PROC REPORT: wrapping of column values
Jim,
have you tried the combination of FLOW and WIDTH? Like so?
<sasl:code>
data jim;
infile cards;
input v1 v2 $char10. +1 v3 $char10.;
cards;
2004 my data any string
2004 your data any string
2004 his data any string
2004 everybodys any string
;run;
proc report data=jim nowd;
columns v1 v2 v3;
define v1 / group;
define v2 / across width=5 flow order=data;
define v3 / display width=6 flow;
run;
</sasl:code>
Result (SAS 8.2 on Win2k)
v2
my your his every
v1 data data data bodys v3
2004 any
1 . . . string
any
. 1 . . string
any
. . 1 . string
any
. . . 1 string
Or did I misinterpret your question?
Robert Bardos
Ansys AG, Switzerland
-----Ursprüngliche Nachricht-----
Von: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU]Im Auftrag von
Groeneveld, Jim
Gesendet: Dienstag, 6. April 2004 15:07
An: SAS-L@LISTSERV.UGA.EDU
Betreff: PROC REPORT: wrapping of column values
Hi friends,
For years I seem (according to some old notes) to be searching for a feature
to automatically wrap column values of across variables in PROC REPORT. It
appears that both SAS 6.12 and SAS 8.2 with the FLOW option do not wrap
formatted or unformatted character values (or even headers) above columns
when and where that would be logical, not even on spaces. The SAS online doc
says it wraps the text at a predefined split character, which is assumed to
be a space if not defined. But I have never seen a result (with spaces) that
I wanted. Does anybody have a good work-around for this without changing
values, without inserting a split character?
Regards - Jim.
<rest snipped>