Bookmark and Share

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: Problmes with the ID in Panel dataset

From   Nick Cox <>
To   "''" <>
Subject   st: RE: Problmes with the ID in Panel dataset
Date   Thu, 2 Dec 2010 11:15:29 +0000

Setting aside the serious possibility of sex reassignment surgery, it would seem that the simplest option is to form new identifiers from 

. egen newID = concat(ID sex) 

which has to be applied before merging. -egen, group()- for once strikes me as a bad idea. 


Cinzia Rienzo

I am struggling to solve a problem with the id in the panel dataset I 
am using and I would appreciate any advices:

First of all the panel data has a problem of duplicated id for the 
worker identifiers; I can solve this (and  I did) just using the 
duplicates commands.
However after merging the data for different years I realised that the 
same id  in different  years sometimes  identifies  different workers, 
here is an example:

ID    year   sex   yearbirth     wage 
12   1986    1           1965              2
12   1987    2           1958              3.2
12   1988    1           1965              2.3
12   1989    2           1958              4.1
13   1986    2           1960               2
13   1987    2           1960               2.2
13   1988    1           1954               3.4

Now I have been searching through the FAQ but I could not find a 
solution appropriate to my query; 
I have tried the tag id sex, but it did not help and also I have tried 
something similar to:

The second problem is that when using the merge or joinby commands 
(with STATA 10) to merge different years combining by  “id sex 
yearbirth”  the dataset is not merged properly since the above problem 
Maybe I should drop the duplicates after the merging, if I would be 
able to make that work properly!

*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index