Note that there are some explanatory texts on larger screens.

plurals
  1. POStata: Identifying unique observations that differ on all variables, by group
    primarykey
    data
    text
    <p>My Stata dataset contains observations on constituent components of products created by different players in a simulation. I would like to retain only the products (created by each player) that consist of distinct and unique components, i.e. identify the observations (by player_id) which differ on ALL variables. </p> <p>The data are:</p> <blockquote> <blockquote> <blockquote> <pre> +---------+-----------+------------+------------+------------+ | Product | Player id | Component1 | Component2 | Component3 | +---------+-----------+------------+------------+------------+ | 1 | 1 | 1 | 2 | 3 | | 2 | 1 | 1 | 5 | 9 | | 3 | 1 | 7 | 8 | 9 | | 4 | 2 | 4 | 5 | 6 | | 5 | 2 | 4 | 5 | 9 | | 6 | 2 | 7 | 8 | 9 | +---------+-----------+------------+------------+------------+ </pre> </blockquote> </blockquote> </blockquote> <p>The desirable outcome should allow me to have the following outcome:</p> <blockquote> <blockquote> <blockquote> <blockquote> <pre> +---------+-----------+------------+------------+------------+ | Product | Player id | Component1 | Component2 | Component3 | +---------+-----------+------------+------------+------------+ | 1 | 1 | 1 | 2 | 3 | | 3 | 1 | 7 | 8 | 9 | | 4 | 2 | 4 | 5 | 6 | | 6 | 2 | 7 | 8 | 9 | +---------+-----------+------------+------------+------------+</pre> </blockquote> </blockquote> </blockquote> </blockquote> <p>As one can see, Product 2 should be removed because it has common component 1 with product 1 and common component 3 with product 3; similarly product 5 should be removed because it shares components 1 and 2 with product 4, and component 3 with product 6.</p> <p>The remaining products (by player) should be kept because they draw on distinct non-overlapping components. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload