Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: RE: Use 'tab' function to tabulate the reversed data

 From Nick Cox To "'statalist@hsphsun2.harvard.edu'" Subject st: RE: Use 'tab' function to tabulate the reversed data Date Mon, 24 Jan 2011 19:34:20 +0000

```Phil Ender's -rtab- does this. Use -findit rtab- to find it.

(I was surprised that more things don't (seem to). But one nice solution is fine!)

Nick
n.j.cox@durham.ac.uk

keeler james

I wonder if anyone can help. For data tabulation of a field in a dataset you can use the command 'tab mk' to list the frequency table as folows. What if we want to do a 'tab' for reversed mk, i.e. starting the largest number first to the smallest number last? In this case it is 112, 109, 106.7, ..., 22, 15.3 1nd 6.7? many thanks.

calchas

. tab mk

Assessment |
mark |      Freq.     Percent        Cum.
------------+-----------------------------------
6.7 |          1        0.09        0.09
15.3 |          1        0.09        0.18
22 |          1        0.09        0.27
23.7 |          1        0.09        0.35
24.7 |          1        0.09        0.44
25.3 |          1        0.09        0.53
26.3 |          1        0.09        0.62
28.7 |          1        0.09        0.71
29.7 |          1        0.09        0.80
31 |          1        0.09        0.88
31.7 |          2        0.18        1.06
32.7 |          1        0.09        1.15
34.7 |          1        0.09        1.24
36 |          2        0.18        1.41
37.3 |          1        0.09        1.50
38 |          1        0.09        1.59
38.7 |          1        0.09        1.68
39.3 |          1        0.09        1.77
40.7 |          1        0.09        1.86
41.7 |          1        0.09        1.94
42 |          1        0.09        2.03
42.7 |          3        0.27        2.30
43 |          1        0.09        2.39
43.3 |          2        0.18        2.56
43.7 |          2        0.18        2.74
44 |          1        0.09        2.83
44.3 |          2        0.18        3.00
44.7 |          1        0.09        3.09
45 |          2        0.18        3.27
45.7 |          4        0.35        3.62
46.7 |          3        0.27        3.89
47 |          1        0.09        3.98
47.3 |          2        0.18        4.15
47.7 |          2        0.18        4.33
48.3 |          1        0.09        4.42
48.7 |          4        0.35        4.77
49 |          2        0.18        4.95
49.3 |          2        0.18        5.12
49.7 |          2        0.18        5.30
50 |          3        0.27        5.57
50.3 |          2        0.18        5.74
50.7 |          4        0.35        6.10
51 |          3        0.27        6.36
51.3 |          1        0.09        6.45
51.7 |          4        0.35        6.80
52 |          4        0.35        7.16
52.3 |          2        0.18        7.33
52.7 |          6        0.53        7.86
53 |          7        0.62        8.48
53.3 |          5        0.44        8.92
53.7 |          1        0.09        9.01
54 |          3        0.27        9.28
54.3 |          4        0.35        9.63
54.7 |          3        0.27        9.89
55 |          6        0.53       10.42
55.3 |          5        0.44       10.87
55.7 |          5        0.44       11.31
56 |          3        0.27       11.57
56.3 |          6        0.53       12.10
56.7 |          5        0.44       12.54
57 |          2        0.18       12.72
57.3 |          6        0.53       13.25
57.7 |          2        0.18       13.43
58 |          2        0.18       13.60
58.3 |          1        0.09       13.69
58.7 |          4        0.35       14.05
59 |          3        0.27       14.31
59.3 |          9        0.80       15.11
59.7 |          4        0.35       15.46
60 |          7        0.62       16.08
60.3 |          7        0.62       16.70
60.7 |          6        0.53       17.23
61 |          4        0.35       17.58
61.3 |          7        0.62       18.20
61.7 |          1        0.09       18.29
62 |          6        0.53       18.82
62.3 |         10        0.88       19.70
62.7 |          6        0.53       20.23
63 |          8        0.71       20.94
63.3 |          7        0.62       21.55
63.7 |          6        0.53       22.08
64 |          5        0.44       22.53
64.3 |          9        0.80       23.32
64.7 |          5        0.44       23.76
65 |          9        0.80       24.56
65.3 |          5        0.44       25.00
65.7 |          9        0.80       25.80
66 |          8        0.71       26.50
66.3 |          8        0.71       27.21
66.7 |         10        0.88       28.09
67 |         13        1.15       29.24
67.3 |          4        0.35       29.59
67.7 |          6        0.53       30.12
68 |          8        0.71       30.83
68.3 |          7        0.62       31.45
68.7 |         14        1.24       32.69
69 |         10        0.88       33.57
69.3 |         12        1.06       34.63
69.7 |         13        1.15       35.78
70 |          7        0.62       36.40
70.3 |          4        0.35       36.75
70.7 |          8        0.71       37.46
71 |         10        0.88       38.34
71.3 |          9        0.80       39.13
71.7 |         10        0.88       40.02
72 |          9        0.80       40.81
72.3 |          5        0.44       41.25
72.7 |         13        1.15       42.40
73 |         14        1.24       43.64
73.3 |         13        1.15       44.79
73.7 |         10        0.88       45.67
74 |          4        0.35       46.02
74.3 |          7        0.62       46.64
74.7 |         10        0.88       47.53
75 |         14        1.24       48.76
75.3 |          7        0.62       49.38
75.5 |          1        0.09       49.47
75.7 |          6        0.53       50.00
76 |          9        0.80       50.80
76.3 |          8        0.71       51.50
76.7 |         12        1.06       52.56
77 |         10        0.88       53.45
77.3 |         13        1.15       54.59
77.4 |          1        0.09       54.68
77.7 |         15        1.33       56.01
78 |          7        0.62       56.63
78.3 |         12        1.06       57.69
78.7 |          9        0.80       58.48
79 |         10        0.88       59.36
79.3 |         13        1.15       60.51
79.7 |          8        0.71       61.22
80 |         13        1.15       62.37
80.3 |         12        1.06       63.43
80.7 |          6        0.53       63.96
81 |          5        0.44       64.40
81.3 |          6        0.53       64.93
81.7 |          9        0.80       65.72
82 |         12        1.06       66.78
82.3 |         16        1.41       68.20
82.7 |         12        1.06       69.26
83 |         12        1.06       70.32
83.3 |         10        0.88       71.20
83.7 |         12        1.06       72.26
84 |          5        0.44       72.70
84.3 |         13        1.15       73.85
84.7 |         10        0.88       74.73
85 |         14        1.24       75.97
85.3 |          9        0.80       76.77
85.7 |         10        0.88       77.65
86 |          8        0.71       78.36
86.3 |         10        0.88       79.24
86.7 |         10        0.88       80.12
87 |         14        1.24       81.36
87.3 |          4        0.35       81.71
87.7 |          8        0.71       82.42
88 |          5        0.44       82.86
88.3 |          7        0.62       83.48
88.7 |         10        0.88       84.36
89 |          7        0.62       84.98
89.3 |          8        0.71       85.69
89.7 |          8        0.71       86.40
90 |          7        0.62       87.01
90.3 |          7        0.62       87.63
90.7 |          7        0.62       88.25
91 |          7        0.62       88.87
91.3 |          6        0.53       89.40
91.7 |          9        0.80       90.19
92 |          8        0.71       90.90
92.3 |          1        0.09       90.99
92.7 |          9        0.80       91.78
93 |          5        0.44       92.23
93.3 |          6        0.53       92.76
93.7 |          4        0.35       93.11
94 |          7        0.62       93.73
94.3 |          7        0.62       94.35
94.7 |          1        0.09       94.43
95 |          5        0.44       94.88
95.3 |          4        0.35       95.23
95.7 |          3        0.27       95.49
96 |          2        0.18       95.67
96.3 |          1        0.09       95.76
96.7 |          4        0.35       96.11
97 |          4        0.35       96.47
97.3 |          8        0.71       97.17
97.7 |          3        0.27       97.44
98 |          2        0.18       97.61
98.3 |          2        0.18       97.79
98.7 |          3        0.27       98.06
99 |          2        0.18       98.23
99.7 |          3        0.27       98.50
100 |          3        0.27       98.76
100.3 |          2        0.18       98.94
101 |          1        0.09       99.03
101.3 |          1        0.09       99.12
102 |          1        0.09       99.20
103 |          2        0.18       99.38
103.7 |          1        0.09       99.47
104 |          1        0.09       99.56
104.3 |          1        0.09       99.65
106 |          1        0.09       99.73
106.7 |          1        0.09       99.82
109 |          1        0.09       99.91
112 |          1        0.09      100.00
------------+-----------------------------------
Total |      1,132      100.00

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```