## Stata 15 help for mf_uniqrows

```
[M-5] uniqrows() -- Obtain sorted, unique values

Syntax

transmorphic matrix uniqrows(transmorphic matrix P)

transmorphic matrix uniqrows(transmorphic matrix P, freq)

where
freq = 0 (frequencies are not calculated) or
1 (frequencies are calculated)

Description

uniqrows(P) returns a sorted matrix containing the unique rows of P.

uniqrows(P, freq) does the same but lets you specify whether the
frequencies with which each combination occurs should be calculated.
Using uniqrows(P, 0) is the same as using uniqrows(P).  uniqrows(P, 1)
specifies that the frequencies with which each combination occurs should
be calculated.

Remarks

: x
1   2   3
+-------------+
1 |  4   5   7  |
2 |  4   5   6  |
3 |  1   2   3  |
4 |  4   5   6  |
+-------------+

: uniqrows(x)
1   2   3
+-------------+
1 |  1   2   3  |
2 |  4   5   6  |
3 |  4   5   7  |
+-------------+

: uniqrows(x, 1)
1   2   3
+-----------------+
1 |  1   2   3   1  |
2 |  4   5   6   2  |
3 |  4   5   7   1  |
+-----------------+

Conformability

uniqrows(P, 0)
P:  r1 x c1
result:  r2 x c1, r2 <= r1

uniqrows(P, 1)
P:  r1 x c1
result:  r2 x c1 + 1, r2 <= r1

Diagnostics

In uniqrows(P), if rows(P)==0, J(0, cols(P), missingof(P)) is returned.

If rows(P)>0 and cols(P)==0, J(1, 0, missingof(P)) is returned.

Source code

uniqrows.mata

```