I have a dataset where each row is a firm, year pair with a firmid
that is a string.
If I do
duplicates drop firmid year, force
it doesn't delete anything since there are no duplicates (I originally created the dataset after running duplicates drop firmid year, force
).
So far so good. I want to create a panel which requires a firmid
that is numeric. So I run
egen newid = group(firmid)
xtset newid year
But the 'repeated time values in panel' error pops up. Moreover,
duplicates list newid year
lists a whole bunch of duplicates.
It seems as though egen, group()
isn't generating unique groups. My question is: why, and how do I create unique groups in a robust way?
help input
for creating short example data within a do-file. – Roberto Ferrerfirmid
for the duplicates? It would be handy to see all three variables when there are duplicates. – Richard Herronencode
, see help. – StasK