If you want to display the group number for every raid member, you can use this code:
Code:
if not UnitInRaid("PLAYER") then return end
for i = 1 , GetNumRaidMembers() do
name, _, subgroup = GetRaidRosterInfo(i)
if (name == Name(unit)) then
return subgroup
end
end
combined with the created event PARTY_MEMBERS_CHANGED that mrruben5 mentioned.