I am working on a data that consists the following variables - firms, years and the product codes of the goods produced by these firms during their reported years. So, for example, firm A produces goods 1, 2 and 3 in 2004, goods 2 and 4 in 2005 and so on.Now I want to create a variable - that indicates the number of products added by a firm during each reported year. Howevwer, there are instances that a firm introduce a product then drop it and reintroduce it. Here i don't want to consider the ''reintroduction'' of the product. i just want to see the first appearance of a product. can anyone help regarding this ? sample data is attached. thanks a lot