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
Eliminating reverse pair in trade dataDear Users, Greetings of the day! I am working on a gravity model and need help in data preparation…
Number of clusters in fracregI am working with data at the firm-year level where I am running a regression with standard errors c…
creating a table with mean plus/minus SD in each cellHello! I'm using Stata 14.1 on Windows. I am creating a table that has mean plus/minus standard devi…
Threshold Regression in STATA 17Hi, I want to run the following regression: threshold inv, threshvar(lagtotaldebtofgdp) regionvars…
Cannot connect to SQL Database TableHello, I'm attempting to import data from a table in SQL Server into Stata. I've setup the connecti…
Subscribe to:
Post Comments (Atom)
0 Response to Generate mean depending on variable specification
Post a Comment