my data set looks something like this:
input str23 CITY int HOM long POP int YEAR
"AKRON" 19 230856 1984
"AKRON" 17 226704 1985
"ALBUQUERQUE" 28 356366 1984
"ALBUQUERQUE" 42 357051 1985
"ALBUQUERQUE" 28 -9 2006
There are multiple variables, some are nonnumeric, and each city has observations for the years 1984-2002. I want to take the averages of each individual variable for the observations of each city. For example a new value of HOM for AKRON would be the mean of all the values for AKRON HOM from all of the AKRON rows. Is there a way to do this?
input str23 CITY int HOM long POP int YEAR
"AKRON" 19 230856 1984
"AKRON" 17 226704 1985
"ALBUQUERQUE" 28 356366 1984
"ALBUQUERQUE" 42 357051 1985
"ALBUQUERQUE" 28 -9 2006
There are multiple variables, some are nonnumeric, and each city has observations for the years 1984-2002. I want to take the averages of each individual variable for the observations of each city. For example a new value of HOM for AKRON would be the mean of all the values for AKRON HOM from all of the AKRON rows. Is there a way to do this?
Comment