Dear folks,
I am currently working on a dataset that contains sales data of items in stores across the country. Each row represents a purchase and contains information on the amount of product name, product brand, units sold, unit price, date, store name, store brand, state of store, etc. For the sake of price analysis, I am currently trying to create a mean price across the whole observational period. However, as prices obviously differ across brands, store types and time, one has to create several individual means that control for each of these variable specifications.
More precisely:
I want Stata to create individual mean prices for each of all observations that share:
The same product (variable 1)
The same store type (variable 2)
The same state of store (variable 3)
The same week of purchase (variable 4)
The same year of purchase (variable 5)
I have some working knowledge with creating new variables, means, etc. in Stata. However, I haven't managed to do get it done if the mean depends on more than one variable as in the case above.
Many thanks in advance!
Related Posts with Generate mean depending on variable specification
Clusteff command for panel dataDear Statalisters, could anyone tell me whether the command "clusteff" can also be applied to panel …
coefplot - creating a vertical coefficient plot with multiple lines across the entire x-axisDear Stata users, I'm having a problem creating a coefficient plot with Stata that produces vertica…
Rolling percentiles for large datasetHi, I have a large dataset containing more than 30m observations. The dataset aggregates daily trad…
Help with Time trends and collinearity in a panel data setDear Statalister, I have a panel data set (xtset msa year) for 291 MSAs over eight years. I have ru…
Survey data: Make a decision between Poisson regression and Negative binomial regressionDear Stata users, I hold a question here: I am using survey data and deciding which regression mode…
Subscribe to:
Post Comments (Atom)
0 Response to Generate mean depending on variable specification
Post a Comment