Hello, I am studying a policy reform by using a duration model (cox proportional hazard).

When I am running the model without unobserved heterogeneity (stcox [vars]) there are no problems. But when I try to include unobserved heterogeneity (stcox ]vars], shared(id) frailty(gamma)) I get the message: shared(): delayed entries or gaps detected.

My dataset looks something like this:
id first year gender reform
1 0 2005 0 0
1 0 2006 0 0
1 1 2007 0 0
1 0 2008 0 0
2 0 2002 1 1
2 0 2003 1 1
3 0 2007 0 1
3 0 2008 0 1
3 1 2009 0 1

The commands I use are the following:

stset year, id(id) failure(first)
stcox reform##age gender if age >=60 & age <=64
stcox reform##age gender if age >=60 & age <=64, shared(id) frailty(gamma) --> 'delayed entries or gaps detected'.


I have tried to use:
* stdes (which indicates no delayed entries or gaps),
* missable sum [vars] and then deleting the observations with missing values,
* forceshared which leads to the message: matsize too small set matsize to at least 2103'
* streg [vars], sist(weibull) shared(id) frailty(gamma)

Do you have any recommendations or solutions to why I struggle including unobserved heterogeneity in my model?