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: RE: Problmes with the ID in Panel dataset

From   "Rienzo, C" <>
To   "Rienzo, C" <>, <>
Subject   st: RE: RE: Problmes with the ID in Panel dataset
Date   Thu, 2 Dec 2010 11:27:44 -0000

Sorry Nick, forget about this you suggested something different than the group.



-----Original Message-----
From: Rienzo, C 
Sent: 02 December 2010 11:25
To: ''
Subject: RE: RE: Problmes with the ID in Panel dataset

Thanks Nick, 
I have thought about the group, but one issue (that I did not mention) is that the panel is unbalanced so if I create a group with the example I gave before that would be:

ID    year   sex   yearbirth    group    
12   1986    1           1965     1         
13   1986    2           1960     2

But if the first group in year 1987 identifies a different worker:
ID   year    sex   yearbirth   group
10   1987    1       1955         1
12   1987    2       1958         2
13   1987    2       1960         3   

Then when merging by group I won't  get the correct merging? Am I wrong?


From: [] On Behalf Of Nick Cox
Sent: 02 December 2010 11:15
To: ''
Subject: st: RE: Problmes with the ID in Panel dataset

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:

*   For searches and help try:

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