At the moment, when a soldier squad (aka group) has no more units it is immediately deleted from the mission and all variables referencing it are unusable.
This can be a problem in missions where some information needs to be stored for each squad. For instance, in my mission I set variables on some squads that specify what vehicles are available, with what respawn times, etc (these are local to each player, no need to sync over the network). I also associate the squad with its map marker color.
It is a lot more elegant, easy and efficient not to remove these mission editor placed squads when they are empty than trying to synchronize variables across the network every time a player joins an empty squad.
One suggestion is to use something like:
mygroup setvariable ["BIS_fnc_makePersistent", true]