How to create additional observations per each observation in my dataset?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How to create additional observations per each observation in my dataset?

opka
This post has NOT been accepted by the mailing list yet.
This post was updated on .
My dataset reflects single purchases by product category and looks like this:

product category  units
          1                 1
          2                 1

Given that I have 3 categories of products, I need to show that for each given observation, purchases for other categories were zero in a given time:

product category  units
          1                 1
          2                 0
          3                 0
          1                 0
          2                 1
          3                 0


In other words, per each product category, can you please help me generate missing product categories with units equal to zero?