Help from Stata users

#1
Hello Stata users:

I am looking to create a new variable (Number) that will count the number of members present in an existing room at a particular time.

Here is an example of my data and what I am looking to do:


Person DateEntered Room DateStayed Number

1 23March2014 Red 23March2014 0
1 23March2014 red 24March2014 0
1 23March2014 red 25March2014 0
1 1August2013 blue 1August2013 0
1 1August2013 blue 2August2013 0
1 3April2014 Orange 3April2014 1
1 3April2014 Orange 4April2014 1
1 3April2014 Orange 5April2014 1
1 3April2014 orange 6April2014 1
3 1April2013 Orange 1April2013 0
3 1April2013 Orange 2April2013 0
3 1April2013 orange 3April2013 0
2 24March2014 Red 24March2014 1
2 24March2014 red 25March2014 1
2 24March2014 Red 26March2014 1
2 24March2014 red 27March2014 1
2 24March2014 red 28March2014 1
4 3October2013 Purple 3October2013 0
4 3October2013 Purple 4October2013 0
4 3October2013 Purple 4October2013 0
3 2August2013 blue 2August2013 1
3 2August2013 blue 3August2013 1
3 2August2013 blue 4August2013 1

Using this data I’m trying to determine when each person enters a room, how many people are there already on the date of entry. So for example, in this example when Person 2 enters Red room on 24 March, person 1 is already present so Number = 1 for Person2 during his presence in room Red.
I am looking to create the dummy variable Number that will take the value 1 if there is a person present in the room it enters on the entry date. The dummy variable is to remain 1 for the remainder of the entry person's stay. If no one is present in the room on the date of entry then the variable Number equals 0.