@AYBiBTU wrote:
That will not work in my real situation as I am using pre-compiled formats from a external format library. It also would not have the desired result for the final frequency column.
I suspect that you are going to have issues with most approaches as long as your formats use other='NOT APPLICABLE' as then missing values will have 'NOT APPLICABLE' regardless of the setting of the missing option.
This creates a table that looks like your desired output for content though not column headings and does require creating additional variables.
data have;
input foo @@;
cards;
1 2 3 4 5 1 3 1 3 5 5 5
;
run;
proc format LIBRARY=WORK;
value wide (default=20)
1 = 'VERY SATISFIED'
2 = 'SATISFIED'
3 = 'DISSATISFIED'
4 = 'VERY DISSATISFIED'
5-high = 'NOT APPLICABLE';
value thin (default=20)
1, 2 = 'SATISFIED'
3, 4 = 'DISSATISFIED'
5-high = 'NOT APPLICABLE';
run;
proc summary data=have nway;
class foo;
var foo;
format foo wide.;
output out=sum1 (drop= _: ) n=foon;
run;
proc summary data=have nway;
class foo;
var foo;
format foo thin.;
output out=sum2(drop= _: ) n=foon2;
run;
options missing=' ';
proc sql;
create table want as
select a.foo format=f1., put(a.foo,wide.) as foow,foon,put(b.foo,thin.) as foot,b.foon2
from sum1 as a
left join
sum2 as b
on a.foo = b.foo
;
quit;
So you may want to discuss the use of "other" with the external format library manager.
... View more