From Creatures Wikia
The Sort Hat, when clicked, sorts all creatures by metaroom as evenly as possible. You can change where the sort hat sorts by putting the flags wherever you wish. For example, to sort creatures to C12DS, pick up a flag and drop it in C12DS. Then the next time you activate the sort hat, if the flag has not moved, creatures will be sent to C12DS if there is enough.
You can pick up the Sort Hat at The High Tech Hand.