|
Hi Joe:
Thanks. I thought cases.sum would be the column total and not the actual
value of cases in each cell. So yes, the rows are displayed as I wanted
now. But now I get the summary total at the bottom.
I thought this statement would give me the column total:
if upcase(_break_)='_RBREAK_' then do;
newcases= LEFT( PUT(cases.sum , 8.0));
end;
If it's not this statement, how to I get the column total at the bottom?
It's now a character column so not sure how?
________________________________
From: Joe Matise [mailto:snoopy369@gmail.com]
Sent: September 21, 2010 10:22 AM
To: Blanchard, Nadeene (MOH)
Cc: SAS-L@listserv.uga.edu
Subject: Re: conditional formatting with proc report
_NULL_ led me to the right answer here. An analysis variable is ONLY
available as an analysis element - ie, CASES is not available, but
CASES.SUM is. So:
proc report data=test nowindows split='*' ;
column cases facid instid newcases;
define cases / analysis ;
define newcases / computed style=test1 ;
define facid / order display 'Facility*Number' ;
define instid / order display 'Institution*Number' ;
compute newcases / char length=12;
if upcase(_break_)='_RBREAK_' then do;
newcases= LEFT( PUT(cases.sum , 8.0));
end;
else if facid in (200,300) then newcases='N/A';
else if cases.sum eq . then newcases='NOT REPORTED';
else newcases=LEFT( PUT(cases.sum , 8.0));
endcomp;
run;
Will work (or, at least will provide some output and eliminate the
'missing' statement in the log). Whether it does what you want it to, I
don't know; it doesn't really read correctly (the IF statement isn't
really doing anything here, I don't think - just the else portions).
-Joe
On Tue, Sep 21, 2010 at 9:08 AM, stats20245
<nadeene.blanchard@ontario.ca> wrote:
Hi:
I have been having a lot of trouble trying to get proc report
output to
display a certain way.
Basically, I have 3 columns: facid, instid and cases. They are
all
numeric.
If facid is a specific value then cases should be displayed as
N/A.
For all other records, if cases is missing then cases should be
displayed
as NOT REPORTED else If cases has a value then the value
should be displayed.
I can't use format for this because missing values could appear
for the
cases value for the specific facids that have to say N/A
for cases and for the others that should say NOT REPORTED.
I did the following code:
data test;
input facid instid cases;
datalines;
100 100 .
100 100 123
200 200 .
300 300 .
;
run;
quit;
proc print data=test;
run;
proc report data=test nowindows split='*' ;
column facid instid cases newcases;
define facid / order display 'Facility*Number' ;
define instid / order display 'Institution*Number' ;
define cases / analysis ;
define newcases / computed style=test1 ;
compute newcases / char length=12;
if upcase(_break_)='_RBREAK_' then do;
newcases= LEFT( PUT(cases.sum , 8.0));
end;
else if facid in (200,300) then newcases='N/A';
else if cases eq . then newcases='NOT REPORTED';
else newcases=LEFT( PUT(cases , 8.0));
endcomp;
run;
quit;
Error Message:
I keep getting this error:
Variable cases is uninitialized.
Why is cases uninitialised when it is one of the named
columns!!!!
Please help.
Thanks
|