Hi,
I have a dataset with the following variables:
- Brand (41 brands in total)
- product identifier (identifies unique product and unique brand)
- Date started
- Date ended
- Brand start
- Brand end
ex:
product identifier / brand / date started / date ended / Brand start / Brand end
101-------------------- A--------- 2001 ----------2002 ---------1990 ---------2010
102-------------------- A ---------2008 ----------2010 ---------1990 ---------2010
I would like to analyze how many different products are produced by a given brand, year by year (generate a new dataset).
My initial idea was to create a duplicate my observations so that I now have a row for each year between brand start and brand end. I then wanted to sum columns X conditional on the brand name, and date started being before the year corresponding to the row, and date ended being after the year corresponding to the row.
product identifier / brand / date started / date ended / Brand start / Brand end / Year / X / Value of interest
101 ----------------------A---- 2001------------- 2002 -------------1990 ---------2010 ------1990-- 1-------------- ?
----------------------------A--------------------------------------------------------------------- ------1990-- 0-------------- ?
...
102 ----------------------A---- 1008------------- 2010 -------------1990 ---------2010 ------1990-- 1-------------- ?
----------------------------A--------------------------------------------------------------------- ------1991-- 0-------------- ?
----------------------------A--------------------------------------------------------------------- ------1992-- 0-------------- ?
----------------------------A--------------------------------------------------------------------- ------1993-- 0-------------- ?
----------------------------A--------------------------------------------------------------------- ------1994-- 0-------------- ?
----------------------------A--------------------------------------------------------------------- ------1995-- 0-------------- ?
Value of interest would be calculated by adding the value in the X column for each row that meet the criteria: for the value of interest, brand has to be A, date started has to be before 1990, date ended has to be after 1990.
I did this without any problems in Excel but I have no idea of how to do it with STATA. Any suggestions?
Thank you very much in advance.
Josh.
I have a dataset with the following variables:
- Brand (41 brands in total)
- product identifier (identifies unique product and unique brand)
- Date started
- Date ended
- Brand start
- Brand end
ex:
product identifier / brand / date started / date ended / Brand start / Brand end
101-------------------- A--------- 2001 ----------2002 ---------1990 ---------2010
102-------------------- A ---------2008 ----------2010 ---------1990 ---------2010
I would like to analyze how many different products are produced by a given brand, year by year (generate a new dataset).
My initial idea was to create a duplicate my observations so that I now have a row for each year between brand start and brand end. I then wanted to sum columns X conditional on the brand name, and date started being before the year corresponding to the row, and date ended being after the year corresponding to the row.
product identifier / brand / date started / date ended / Brand start / Brand end / Year / X / Value of interest
101 ----------------------A---- 2001------------- 2002 -------------1990 ---------2010 ------1990-- 1-------------- ?
----------------------------A--------------------------------------------------------------------- ------1990-- 0-------------- ?
...
102 ----------------------A---- 1008------------- 2010 -------------1990 ---------2010 ------1990-- 1-------------- ?
----------------------------A--------------------------------------------------------------------- ------1991-- 0-------------- ?
----------------------------A--------------------------------------------------------------------- ------1992-- 0-------------- ?
----------------------------A--------------------------------------------------------------------- ------1993-- 0-------------- ?
----------------------------A--------------------------------------------------------------------- ------1994-- 0-------------- ?
----------------------------A--------------------------------------------------------------------- ------1995-- 0-------------- ?
Value of interest would be calculated by adding the value in the X column for each row that meet the criteria: for the value of interest, brand has to be A, date started has to be before 1990, date ended has to be after 1990.
I did this without any problems in Excel but I have no idea of how to do it with STATA. Any suggestions?
Thank you very much in advance.
Josh.
Comment