Date: Thu, 27 Apr 2000 20:36:18 -0500
Reply-To: Jonathan_Goldberg@MASTERCARD.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jonathan Goldberg <Jonathan_Goldberg@MASTERCARD.COM>
Subject: Re: writing data two columns across page
Content-type: text/plain; charset=us-ascii
Jamil Ibrahim <jibrahim@IR.UMSMED.EDU> asks about some custom report-writing
code.
He has two problems: 1) the output goes to a new page too early, and 2) the
overall mean and overall standard deviation are never printed.
The answer to problem 2 is buried in obscure formatting. I untangled things a
bit:
DATA REPORT;
SET WORK END=EOF; BY MONTH ID Q;
CURRENT=TODAY();
FORMAT CURRENT MMDDYY8.;
file print n=ps LS=150 header=hdr;
do column=1, 60;
col=column+24;
cl=column+34;
do LINE=5 TO 82 BY 20;
SET WORK END=EOF; BY MONTH ID Q;
IF FIRST.MONTH THEN PUT _PAGE_;
A+1;
PUT #LINE @COLUMN DESC1 ;
IF DESC2 NE ' ' THEN do; PUT @COLUMN DESC2 ;end;
IF DESC3 NE ' ' THEN do; PUT @COLUMN DESC3 ;end;
IF DESC4 NE ' ' THEN do; PUT @COLUMN DESC4 ;end;
PUT @COLUMN 57*'_' /
@COLUMN 'CHOICE' @col 'COUNT' @CL 'PERCENT'/
@COLUMN 57*'_' /
@COLUMN '1 Extremely Unclear' @COL CNT1 5. @CL PCT1 5. '%' / /
@COLUMN '2 Unclear' @col CNT2 5. @cL PCT2 5. '%' / /
@COLUMN '3 Average' @col CNT3 5. @cL PCT4 5. '%' / /
@COLUMN '4 Clear' @col CNT4 5. @cL PCT5 5. '%' / /
@COLUMN '5 Extremely Clear' @col CNT5 5. @CL PCT6 5. '%' /
@COLUMN ' OMIT' @col CNT&Y 5. @CL PCT&Y 5. '%' /
@COLUMN 57*'_' /
@COLUMN "TOTAL= " TOT 3. +4 "MEAN= " M 5.2 +4 "STANDARD DEVIATION= "
ST 5.2 //;
END; /*of loop down the rows*/
LINE+20; /* This statement dosen't do anything, since line is reset by the
loop body*/
END; /*of loop across the columns*/
put _page_;
RETURN;
PUT /// @10 'OVERALL MEAN= ' MM 5.2 /***** THIS CODE IS NEVER
REACHED *****************/
' OVERALL STANDARD DEVIATION=' STM 5.2;
HDR:
A=0;
title1 "Department of Psychiatry - Lecture Evaluation - 631";
PUT /@3 'Id Number: ' id @37 'NUMBER OF RESPONDENTS=' TOT ;
put @1 100*'_' / ;
RETURN;
It is now plain that the code for the overall statistics is unreachable between
the return and the HDR label. In the original this was hard to see because the
loop ends were buried in clutter.
To diagnose problem 1, we need to know what the page size is, because Mr.
Ibrahin is using n=ps print file option. If the value of ps was too small,
hitting the limit would trigger an automatic eject to a new page, and a
corresponding new execution of the header code. I suspect that this is causing
the problem.
Jonathan