Dear All, I found this question here (in Chinese). The variable x denotes the product.
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input id year str1 x
1 2011 "a"
1 2011 "b"
1 2012 "a"
1 2012 "d"
1 2013 "a"
1 2013 "d"
1 2013 "c"
2 2011 "c"
2 2011 "d"
2 2012 "c"
2 2012 "a"
2 2013 "c"
2 2013 "b"
end
The question is to obtain (1) the number of new added product, and (2) the number of retired product, compared to the situation in the previous year for each firm (id) and each year. Any suggestions are highly appreciated.