From: RChaar on
Here is my code so far:

data bob;
input aa $ dqc $;
datalines;
1 F
1 T
1 F
1 F
2 T
2 T
2 F
;
run;
proc sort data=bob; by aa; run;

data bob2(rename =(n=fail));
set bob;
by aa;
n=0;
if dqc = 'F' then n = 1;
m=1;
run;
proc print data=bob2; run;

proc report data = bob2
nowindows missing headline headskip pspace=1;
column AA('Unsatisfactory AAs' fail Percent) m;
define AA /group;
define fail / 'Count';
define Percent / computed format = 6.2;
define m /'Total AAs';
rbreak after / summarize skip dol;
compute Percent;
Percent = (fail.sum /7)*100;
endcomp;
run;

It produces something like this (sorry i'm not good at formatting on
here):


Unsatisfactory AA
Percen
aa Count t
Total AAs

1 3
42.86 4
2 1
14.29 3
========= ====== =========
4
57.14 7


What I want it to do is have the last row in the aa column to say
Total, as well as substitute the sum of Total AAs in for the number 7
in Percent = (fail.sum /7)*100; I tried putting m.sum and it didn't
work out, there were missing values. Is there a way to suppress aa
and the values underneath and just have "Total" at the very last row?
Also, I want the formatting at the top to be straightened out a bit
with Total AAs on the same heading line as Unsatisfactory AAs and the
Count and Percent as a subheading of Unsatisfactory AAs.

I don't use REPORT much so thanks if you can help!

From: RChaar on

Unsatisfactory AA
Percen
aa Count t Total AAs
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ

1 3 42.86 4
2 1 14.29 3
========= ====== =========
4 57.14 7

From: RChaar on

Unsatisfactory AA
Percen
aa Count t
Total AAs
ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ

1 3
42.86 4
2 1
14.29 3
========= ====== =========
4
57.14 7



From: RChaar on
I also tried PROC SQL but didn't get very far either...

data bob (rename = (n=fail));
set bob;
by aa;
retain m 0 n 0;

if first.aa then do;
n=0;
m=1;
if dqc = 'F' then n=1;
end;

if first.aa=0 then do;
if dqc = 'F' then n+1;
m+1;
end;

if last.aa then output;

run;

proc sql;
create table failedaatable as
select aa, sum(n) as Count, (sum(n)/sum(m))*100, sum(m) as Total_AAs
from bob
group by aa
union
select 'Total',
sum(n) as sumtot_failed, sum(m) as sumtot_aa
from bob
order by aa='Total';
;
quit;
From: "Data _null_;" on
Does adding this to your PROC REPORT give the desired result?

compute after;
aa = 'Total';
endcomp;


On 2/17/10, RChaar <rchaar(a)gmail.com> wrote:
> Here is my code so far:
>
> data bob;
> input aa $ dqc $;
> datalines;
> 1 F
> 1 T
> 1 F
> 1 F
> 2 T
> 2 T
> 2 F
> ;
> run;
> proc sort data=bob; by aa; run;
>
> data bob2(rename =(n=fail));
> set bob;
> by aa;
> n=0;
> if dqc = 'F' then n = 1;
> m=1;
> run;
> proc print data=bob2; run;
>
> proc report data = bob2
> nowindows missing headline headskip pspace=1;
> column AA('Unsatisfactory AAs' fail Percent) m;
> define AA /group;
> define fail / 'Count';
> define Percent / computed format = 6.2;
> define m /'Total AAs';
> rbreak after / summarize skip dol;
> compute Percent;
> Percent = (fail.sum /7)*100;
> endcomp;
> run;
>
> It produces something like this (sorry i'm not good at formatting on
> here):
>
>
> Unsatisfactory AA
> Percen
> aa Count t
> Total AAs
>
> 1 3
> 42.86 4
> 2 1
> 14.29 3
> ========= ====== =========
> 4
> 57.14 7
>
>
> What I want it to do is have the last row in the aa column to say
> Total, as well as substitute the sum of Total AAs in for the number 7
> in Percent = (fail.sum /7)*100; I tried putting m.sum and it didn't
> work out, there were missing values. Is there a way to suppress aa
> and the values underneath and just have "Total" at the very last row?
> Also, I want the formatting at the top to be straightened out a bit
> with Total AAs on the same heading line as Unsatisfactory AAs and the
> Count and Percent as a subheading of Unsatisfactory AAs.
>
> I don't use REPORT much so thanks if you can help!
>
 | 
Pages: 1
Prev: Has anyone used DBCS configuration
Next: PDO