I have a data set with 1000 observations. As an example, let's consider the following table:
GroupID Preferences (1 = movie; 2 = sports)
1 1
1 2
1 1
2 2
2 2
2 1
2 2
3 1
3 1
The first column specifies the group name; each number just refers to an individual in the group.

For each group, I want to get a data on the number of people that prefer movie.

So my ideal table will something like this:
GroupID Preferences No of people preferring movie ( = 1) in the group
1 1 2
1 2 2
1 1 2
2 2 1
2 2 1
2 1 1
2 2 1
3 1 2
3 1 2
For the later analysis that I want to do, I really need the third column to look as above.

How can I get such a third column in STATA?

I think something along the following lines would work but cannot figure out by myself.
Code:
gen num_movie = .
foreach j in var Preferences {
    replace num_movie = GroupID if `j' == 1
}