I am working in SAS/STAT 12.1 and I have only one issue with my code below, I need to show "Total" for the bottom row (displaying columns sums and percentages), instead of "Both Genders." And yes, the top right-hand column header (displaying row totals and percentages) still needs to be "Both Genders."
I hope there is a simple way to do this using keylabel, but haven't figured it out so far.
proc tabulate data=dmhrind format=8.1; format gender $gendfmt. ethnic $ethnic.; class ethnic gender; table (ethnic all)*f=4. , (gender all)*(n*f=4. colpctn*f=5.1 rowpctn*f=5.1) ; title 'Ethnic Distribution by Gender'; label ethnic='Race/Ethnicity'; keylabel N='N' colpctn='%' all='Both Genders' reppctn='%' rowpctn = 'Total'; run;
Thanks in advance for any assistance provided.
The only way to do this that I can see is to make a dummy column that simulates All. Using sashelp.class:
data class; set sashelp.class; allage = 'All Ages'; run; proc tabulate data=class format=8.1; class sex age allage; table (age allage=' ')*f=4. , (sex all)*(n*f=4. colpctn*f=5.1 rowpctn*f=5.1) ; title 'age Distribution by sex'; label age='Age'; label allage='All Ages'; keylabel N='N' colpctn='%' all='Both Sexes' reppctn='%' rowpctn = 'Total'; run;
It needs to have the text you want as the label as its actual value, and you need to replace
all in the tabulate with that variable (and add it to the class statement), and add
=' ' to override the extra label subrow.