Your question is a little unclear, if this doesn't cover it, could you be a bit more specific?
I looked for a pre-made API for this, but didn't find one so this should do it.
Code:
function GetSubGroupID()
if not UnitInRaid("PLAYER") then return
for i = 1 , GetNumRaidMembers() do
name, rank, subgroup, level, class, fileName, zone, online, isDead, role, isML = GetRaidRosterInfo(i)
if ( name == UnitName("PLAYER") ) then
return subgroup
end
end
end