Dear Statalist Community,

I have a problem with repeated time values in my panel (daily time intervals). Instead of deleting duplicate id’s per date, I would rather manipulate the id code (which are corporate tickers) by adding a number to one id and eventually creating two different id’s out of a duplicate. Since I have a lot of duplicates (see output below), I would like to do it ideally with a loop. However, the problem is that I need to manipulate the id of just one observation per duplicate. Do you guys have an idea how to run this in Stata?

For example, for the date of 03-14-2017, I got 3 observations of company PPP. Instead of deleting 2 observations and keeping the remaining one for that date, I’d like to create the following: 03/14/2017: PPP PPP1 PPP2.

Any ideas will be highly appreciated!
Thank you very much,
Hans
Code:
xtset Ticker_num Date
repeated time values within panel
r(451);

bysort Ticker_num Date: assert _N == 1
11,119 contradictions in 35,107 by-groups
assertion is false
r(9);

duplicates drop Ticker_num Date, force

Duplicates in terms of Ticker_num Date

(21,660 observations deleted)