| Date: | Mon, 21 Apr 2008 08:49:26 -0400 |
| Reply-To: | "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | "Richard A. DeVenezia" <rdevenezia@WILDBLUE.NET> |
| Subject: | Re: Can PROC REPORT break on sub fields |
|
On Wed, 16 Apr 2008 21:04:26 -0400, Lizette Koehler
<starsoul@MINDSPRING.COM> wrote:
>I am running on the mainframe under z/OS V1.7 using SAS V913 SP4 - Batch SAS
>not interactive.
>
>I am trying to use PROC REPORT to create a report of data set names and
>owners.
>
>I would like to break the report by owner, first level node, second level
>node and possibly third level node. ID is NODE1 is first level node.
>
>
>The DSN consists of 1-5 levels
>A.B.C.D.E.F
>
>I have filtered the data so I have the complete data set name plus the
>various nodes in the data set. The other data is also available in this
>data set.
>
>I would like a report something like this. I can page break on the owner
>which is great, I just need to see if I can also do something when the
>NODE2 and/or NODE3 changes and still subtotal under OWNER and have a final
>Subtotal in the report. I have been reading the text on Proc Report but
>just cannot see how or if this can be done.
Preprocess the data and split out the level (node) values from the DSN into
level variables. Then use the level variables in your COLUMN statement, and
DEFINE them as order (or group) and NOPRINT. This will make the level
variables available for breaking, but will hide them from the output.
------------------------------
data foo;
infile cards dlm=',';
length owner $32 id $8 dsn $50 ser $8 class $8;
input
owner
id
dsn
Ser
Class
Date1 & date7.
Date2 & date7.
Tracks
;
format date1 date2 date7.;
datalines;
John Smith, AAA, AAA.B.C.D, XX0001, MYCLASS, 02APR08, 02APR08, 100
John Smith, AAA, AAA.B.X.F, XX0001, MYCLASS, 02APR01, 02APR08, 10
John Smith, AAA, AAA.C.D, XX0001, MYCLASS, 02MAR99, 02MAR99, 10
John Smith, AAA, AAA.R.M.D, XX0001, MYCLASS, 01FEB08, 02MAR08, 10
John Smith, BBB, BBB.A.A.X, XX0001, MYCLASS, 01FEB08, 02MAR08, 50
Jane Austin,CCD, CCD.C.J.D, XX0002, MYCLASS, 01FEB07, 12DEC08, 10
Jane Austin,CCD, CCD.D.H, XX0003, MYCLASS, 01Jan00, 01FEB06, 10
run;
data foo_view / view=foo_view;
set foo;
_1 = scan(dsn,1,'.');
_2 = scan(dsn,2,'.');
run;
ods pdf file="%sysfunc(pathname(WORK))\sample.pdf" style=journal;
proc report nowd data=foo_view
style(summary) = {background=ltgray}
;
column owner id _1 _2 dsn ser class date1 date2 tracks;
define owner / order order=data;
define id / order order=data;
define _1 / order order=data noprint;
define _2 / order order=data noprint;
define date1 / display;
define date2 / display;
break after owner / summarize;
compute after owner;
line '';
endcomp;
compute after _2;
line '';
endcomp;
run;
ods pdf close;
------------------------------
Richard A. DeVenezia
http://www.devenezia.com
|