I have a hospital dataset declared as a time series with panel data with monthly observations.
Volumes for certain procedures are aggregated to hospital level, and there are some months were no procedures took place, therefore there are missing months for some hospitals
I am comparing volume changes from one month, say February 2020, to February 2019, and so on
I am trying to find a way to calculate this using stata. I have tried a few approaches:

gen absolutechange=episodeid[_n] - episodeid[_n-12]

this does not work as I have missing months for some of the sites

and

gen absolutechange= episodeid[monthly] -episodeid[monthly-12]

I am not sure why the above doesn't work

Does anyone have any suggestions?

Thank you so much in advance