I've been known to say silly things like "everyone must learn to code" and "STEM education trumps all other education". BUT, hear me out on this one.
The future is pretty clear: the knowledge-worker economy. In the future, people are never cogs. We've automated everything cog-like, long ago. The people who do that automation -- who facilitate it, create it -- those people are gold. Their knowledge and ability to create is what empowers the companies that employ them.
And this is why companies like Google and Facebook put so much emphasis on hiring smart people who can create things, even if it means they sit around doing very little (or non-bottom-line-affecting "research"). It's better to have the knowledge on your side, at all times, forever. Give them money, free food, free drinks, gym, whatever it takes to keep them there and keep building the future.
The counter to this is the brain drain. In the modern world of technology and the future world of... well, everything... brain drain is going to be the #1 indicator of a company's demise. Once the net knowledge at a company begins to decrease, their long term prospects are over. It also begins to cascade. Smart people leave and other smart people leave because of it. It's like dominoes. A company may survive well after that brain drain -- it may even grow -- but when it can no longer innovate and respond to market change, then it's dead.
The thing to consider is that you cannot codify what we're talking about here. Codification does not mean innovation. Innovation requires people, always.
In any case, that brings us to Microsoft.
Microsoft is in deep, deep trouble with all of their recent product screwups, like the XBone, Surface RT sales and Windows 8 itself (as I described in my last blog post). BUT, the awesome news is that Microsoft has not significantly lost its great people. It continues to employ many of the smartest people on the planet. And they continue to do great things, one of the most interesting of which (to me) is Typescript.
So no matter what's wrong with Microsoft, they are not seriously suffering from brain drain. So you can't count them out.
Other companies though, it's worth taking a look to see what the influx/outflux looks like when evaluating their long term viability.