Hi!
I hope someone can help me out. After spending several days reading tips&tricks, as well as multiple Statalist posts, I still can't solve this. Here goes.
In this example I want to be able to drop line 3&4. To be specific: For this ID (770), line 1&2 are linked because they have the same category, but I want to be able to specify that "if type = D identify corresponding line with same category as D" In this case I want to keep both line 1&2 as well as 5&6, but I want to drop line 3&4.
I've generated a simple example of my data. Original dataset contains several thousand IDs and multiple variables. Different ID's will not have the same combinations of type and category as this exampe, so what i'm searching for is a way of solving my problem for all ID's not depending on defining each possible combination of type and category.
Hope I made myself clear, otherwise please ask me to explain (English is not my first language), also I hope I've posted the right way, this is my first post.
I hope someone can help me out. After spending several days reading tips&tricks, as well as multiple Statalist posts, I still can't solve this. Here goes.
In this example I want to be able to drop line 3&4. To be specific: For this ID (770), line 1&2 are linked because they have the same category, but I want to be able to specify that "if type = D identify corresponding line with same category as D" In this case I want to keep both line 1&2 as well as 5&6, but I want to drop line 3&4.
I've generated a simple example of my data. Original dataset contains several thousand IDs and multiple variables. Different ID's will not have the same combinations of type and category as this exampe, so what i'm searching for is a way of solving my problem for all ID's not depending on defining each possible combination of type and category.
Hope I made myself clear, otherwise please ask me to explain (English is not my first language), also I hope I've posted the right way, this is my first post.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input int ID long(type category) 770 1 1 770 2 1 770 2 2 770 2 2 770 2 3 770 1 3 end label values type type label def type 1 "D", modify label def type 2 "J", modify label values category category label def category 1 "A", modify label def category 2 "B", modify label def category 3 "C", modify
Comment