Does anyone have a favorite way of tabulating joint frequencies for M>=2 discrete (numeric) outcomes? I've written a program tabjoint to do this (https://uwmadison.box.com/s/r4fdwda8...a99ibd6ybyicbz) that produces the output that appears below.

But I'm wondering if others have more found more efficient ways to undertake and report such tabulations. There's nothing profound about the calculations themselves; I'm mostly curious about how others might have handled this.
Code:
sysuse auto
tabjoint foreign rep78 turn, sort
Code:
  Joint distribution of: foreign rep78 turn

  Joint Outcome |      Freq.     Percent        Cum.
----------------+-----------------------------------
   0   3   43   |          7       10.14       10.14
   0   3   40   |          4        5.80       15.94
   0   3   42   |          4        5.80       21.74
   1   5   36   |          4        5.80       27.54
   0   2   46   |          3        4.35       31.88
   0   4   43   |          3        4.35       36.23
   1   4   34   |          3        4.35       40.58
   0   2   41   |          2        2.90       43.48
   0   3   41   |          2        2.90       46.38
   0   3   44   |          2        2.90       49.28
   0   3   45   |          2        2.90       52.17
   0   4   42   |          2        2.90       55.07
   1   3   36   |          2        2.90       57.97
   1   4   35   |          2        2.90       60.87
   1   4   36   |          2        2.90       63.77
   1   5   35   |          2        2.90       66.67
   1   5   37   |          2        2.90       69.57
   0   1   40   |          1        1.45       71.01
   0   1   42   |          1        1.45       72.46
   0   2   40   |          1        1.45       73.91
   0   2   43   |          1        1.45       75.36
   0   2   44   |          1        1.45       76.81
   0   3   31   |          1        1.45       78.26
   0   3   34   |          1        1.45       79.71
   0   3   36   |          1        1.45       81.16
   0   3   37   |          1        1.45       82.61
   0   3   48   |          1        1.45       84.06
   0   3   51   |          1        1.45       85.51
   0   4   33   |          1        1.45       86.96
   0   4   39   |          1        1.45       88.41
   0   4   45   |          1        1.45       89.86
   0   4   48   |          1        1.45       91.30
   0   5   35   |          1        1.45       92.75
   0   5   37   |          1        1.45       94.20
   1   3   34   |          1        1.45       95.65
   1   4   33   |          1        1.45       97.10
   1   4   38   |          1        1.45       98.55
   1   5   32   |          1        1.45      100.00
----------------+-----------------------------------
          Total |         69      100.00