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
Industry fixed effects in a dynamic panelHi, I want to include the industry fixed effects in a dynamic panel model based on the 2 digit sic …
Conformability error, r(503)Hi everyone, I have a problem when I want to input a matrix in Stata. First I local some results and…
Help me I m new with STATAHi! I m at the beginning of this software and I have to resolve this exercise. Can someone help me? …
Help with long data and counting unique variables by datesHi, I am in desperate need of help! I tried to show my data with dataex but given the size (25 mill…
Conformability error, r(503)Hi everyone, I have a problem when I want to input a matrix in Stata. First I local some results and…
Subscribe to:
Post Comments (Atom)
0 Response to egen and mean help needed
Post a Comment