Dear STATALIST forum,

I have a question about generating a variable that depicts the sum of a dummy variable up until point x. To help you understand, here is how my data looks like right now:
platform year month genre_id Genre1_dummy Genre2_dummy Genre3_dummy
microsoft 2003 4 1 1 0 0
microsoft 2003 8 3 0 0 1
macOS 2002 1 1 1 0 0
macOS 2002 4 2 0 1 0
macOS 2003 8 1 1 0 0
And here is how I would like to have it:
platform year month genre_id Genre1_dummy Genre2_dummy Genre3_dummy genre_1 genre_2 genre_3
microsoft 2003 4 1 1 0 0 1 0 0
microsoft 2003 8 3 0 0 1 1 0 1
macOS 2002 1 1 1 0 0 1 0 0
macOS 2002 4 2 0 1 0 1 1 0
macOS 2003 8 1 1 0 0 2 1 0
To conclude: I would like to generate a sum of the genre dummy up until the observation was made, but not going beyond platforms.

Thanks for your help. It is very much appreciated.

Best,

Sebastian