egen count only but unique values

#1
Hello,

Below is how my dataset looks like:

GranteeID ProviderID
11 11
12 11
26 27
78 27
78 27
33 33
33 33
33 33


I am trying to count the number of unique GranteeIDs by ProviderID. This is my attempt: egen grantee_count = count(GranteeID), by(ProviderID). However, grantee_count is not counting unique IDs. For example, for provider 27 it counts 3 Grantees instead of only 2 unique grantees (26 and 78)

Thank you,
Marvin