Hi, I am trying to generate the index "z" in Stata, so that Z has the same value for all Xs and Ys. For example:

x y z

1 1 1

1 2 1

1 3 1

2 4 2

2 5 3

2 6 3

4 7 4

5 2 1

6 3 1

7 8 5

Any help would be much appreciated. Thanks!

x y z

1 1 1

1 2 1

1 3 1

2 4 2

2 5 3

2 6 3

4 7 4

5 2 1

6 3 1

7 8 5

Any help would be much appreciated. Thanks!

## Comment