Hi everyone,


I'm trying to create a graphic with horizonal bars in which I could stack positive and negative values.
I use data from 2 games. For each game, I have a variable that take the value of 1 if the person won, -1 if he lost and 0 if the person didn't play.
I want to create one bar for each game which count the number of games played (which is the number of victories + defeats, so the number of "-1" and "+1"). However, I want to give different colours to defeats and victories for each bar.

I tried to create two dummies for each game in order to differentiate victories and defeats, but I am unable to stack them together.

Here's an example of data used. "game" refers to the type of game (game 1 or game 2), and "results" show the results described above (victory, not played, defeat)

Thanks in advance!


Code:
 
 clear input game results 1 0  1 1  1 -1  1 1  2 0  2 0  2 -1  2 -1  end
PS: according to the preview, my code will appear in one row rather than column, and I don't understand why. Sorry for that.