proc sql noprint;
create table b as
select count(distinct name) as n,sex from a group by sex;
quit;
proc transpose data=b out=c(drop=_name_) prefix=c;
id sex;
var n;
run;
data d;
length c9 c1 c2 8 col1 col2 $20;
set c;
if missing(c1) then c1=0;
if missing(c2) then c2=0;
c9=c1+c2;
col1=strip(put(c1,best.))||'('||strip(put(c1/c9,percent6.))||")";
col2=strip(put(c2,best.))||'('||strip(put(c2/c9,percent6.))||")";
keep c9 col1 col2;
run;