So if you have actual percentages (so 0.2222 instead of 22.22 )
data CP;
input Treatment $ SEX $ COUNT PERCENT :percent.;
cards;
H1 Male 2 22.22%
H1 Female 7 77.77%
H2 Male 4 36.36%
H2 Female 7 63.63%
;
You could use the fact that the PERCENT format adds () around negative values to make it easier.
data want;
set cp;
length string $20;
string=put(count,comma12.)||' '|| put(-percent,percent7.1);
run;
Obs Treatment SEX COUNT PERCENT string
1 H1 Male 2 0.2222 2 (22.2%)
2 H1 Female 7 0.7777 7 (77.8%)
3 H2 Male 4 0.3636 4 (36.4%)
4 H2 Female 7 0.6363 7 (63.6%)
... View more