Hi all,

I am still a novice at using Stata, and I would like to ask a question.

I have a panel data containing information about hospitals from years 2007 to 2016, and I would like to count the number of observations that have a change in value for a particular variable across the years. More specifically, I would like to count the number of hospitals that have changed ownership from public to private across the years.

My thought process is to first bys hospital_id, and then count the number of observations where private changes from 0 to 1 across the years.
However, I am not too sure what would be the command for this on Stata version 14.

Your inputs will be greatly appreciated. Thank you in advance.

Regards,
Priscilla