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.
Related Posts with egen and mean help needed
Principal component analysis in panel data settingHello to everyone, I have a panel of 190 industries over the 2000-2018 period. my data-set contains…
How to run conditional indirect difference test with categorical moderator in Stata 14.2Hello everyone! Can someone please help me to run the conditional indirect difference test with cat…
Creating a graph with shared areas that cover positive and negative numbers in the y-axisHello, I created a graph that includes markers for each one of the data points and shaded areas for…
How to run conditional indirect difference test in Stata 14.2Hello all, I am having difficulty to run conditional indirect difference test in Stata 14.2. Here i…
Plot count data with SE bars on StataHi, I am looking at code for making a chart where I could plot two variables--- eg: no of times vis…
Subscribe to:
Post Comments (Atom)
0 Response to egen and mean help needed
Post a Comment