S Doradus variables in the Galaxy and the Magellanic Clouds