So, the following would be the solution (untested) for your proc means assuming the class variables are character type: proc sql noprint; create view type11 as select distinct source, Year, /* from by statement in Proc means */ cltname, incentive, /* from class statement in Proc means */ '11' as _TYPE_, count(*) as _FREQ_, /* _TYPE_ and _FREQ_ variables */ Sum(Elig) as ELIG, sum(overall) as overal, /* SUM statistics for var statement */ Sum(initial) as initial, sum(consecutive) as conservative from temp group by source, Year, cltname, incentive; /* from both by and class statements */ create view type10 as select distinct source, Year, cltname, ' ' as incentive, '10' as _TYPE_, count(*) as _FREQ_, Sum(Elig) as ELIG, um(overall) as overal, Sum(initial) as initial, sum(consecutive) as conservative from temp group by source, Year, cltname; create view type01 as select distinct source, Year, ' ' as cltname, incentive, '01' as _TYPE_, count(*) as _FREQ_, Sum(Elig) as ELIG, um(overall) as overal, Sum(initial) as initial, sum(consecutive) as conservative from temp group by source, Year, incentive; create view type00 as select distinct source, Year, ' ' as cltname, ' ' as incentive, '00' as _TYPE_, count(*) as _FREQ_, Sum(Elig) as ELIG, um(overall) as overal, Sum(initial) as initial, sum(consecutive) as conservative from temp group by source, Year; create table smry as select * from type11 union all select * from type10 union all select * from type01 union all select * from type00 order by 1,2,3,4; quit; CTorres
... View more