Dear all, I am dealing with a micro data where I have around 100000 observations from 81 cities about one variable (let's call it as X) which is given in Likert scale (1 to 5, integer ofcourse). Using egen command, I wanted STATA to find the average of X for each city and I wrote the following command:

egen Xcity = mean(X), by(city)
tab Xcity

I am able to get the average values of X for each city. However, I wanted to be sure that the command works correctly. Therefore, I checked the results for few cities using the original data in Excel and my results in Excel are always different than what Stata calculates. I even checked the data in Excel with Stata Stata Data Editor. They both have the same data but different mean values. How is that possible? What is the mistake that I am doing here or what am I missing? I appreciate your help. Thanks.