title1 '13. Analysis of Categorical Data by Column %, Row % and Table %'; proc format; picture mypct (round) low-high='009%'; value agefmt 0 - 15 = 'Ages 0 - 15' 16 - 64 = 'Ages 16 - 64' 65 - 100 = 'Ages 65 - 100'; quit; proc tabulate data=sashelp.class order=formatted missing formchar='________________'; label name='Student'; format age agefmt.; keylabel all='My Total'; class name sex age; var height weight; * Sex as rows by age group of colpctn, rowpctn and pctn options; table sex='Sex' , age='Age Group'*(n='N'*f=5.0 colpctn=' % by columns (COLPCTN)'*f=mypct.) age='Age Group'*(n='N'*f=5.0 rowpctn=' % by rows (ROWPCTN)'*f=mypct.) age='Age Group'*(n='N'*f=5.0 pctn=' % by table (PCTN)'*f=mypct.) /box=[label='Baseline'] rts=30 printmiss misstext='none'; * Alternative to use PCTN<>; *table sex='Sex' , age='Age Group'*(n='N'*f=5.0 pctn=' % by columns (PCTN)'*f=mypct.) age='Age Group'*(n='N'*f=5.0 pctn=' % by rows (PCTN)'*f=mypct.) age='Age Group'*(n='N'*f=5.0 pctn=' % by table (PCTN)'*f=mypct.) /box=[label='Baseline'] rts=30 printmiss misstext='none'; run;