Software is eating the world. Or, at least, that's what famed angel investor Marc Andreessen told The Wall Street Journal back in 2011. The past seven years have proven that thesis out, as software-as-a-service (SaaS) companies have come to dominate many industries.

The low-overhead, easily deployed model of delivery -- combined with the reliability of sticky recurring revenue -- has meant that investments in such companies have proven very lucrative. 

The healthcare field is no exception to this rule, and today, two upstarts -- pharmaceutical cloud player Veeva Systems (NYSE:VEEV) and electronic health records and billing specialist athenahealth (NASDAQ:ATHN) -- go head to head.

A cartoon cloud unzipped with a stethoscope coming out

Image source: Getty Images

While it's impossible to know with 100% certainty which will turn out to be the better stock to buy, there are three lenses through which we can view the question to get a better idea of what we're paying for if we buy shares.

Financial fortitude

We will start with the most straightforward of the three: financial fortitude. This metric hinges on a simple question: How would the company be affected if a major economic crisis were to hit right now?

A fragile company -- with lots of debt, little cash, and negative free cash flow -- would likely crumble. A robust company -- with "safe" levels of cash and modest free cash flow -- could emerge unscathed.

But an "antifragile" company will actually benefit -- in the long run, and relative to competition -- from such a downturn. That's because excessive cash hoards along with very healthy cash flow would give the company options: buying back shares on the cheap, acquiring distressed rivals, or simply bleeding out the competition by undercutting them on price.

Here's how Veeva and athenahealth stack up -- keeping in mind that Veeva is valued at almost twice the size of athenahealth.

Company Cash Debt Free Cash Flow
Veeva $762 million $0 $224 million
Athenahealth $196 million $253 million $78 million

Data: Yahoo! Finance, SEC filings. Cash includes long- and short-term investments. Free cash flow presented on trailing 12-month basis.

Here we have a very clear winner. Athenahealth's sticky free cash flow means that it shouldn't have any trouble meeting its debt obligations. But Veeva's debt-free balance sheet -- combined with very healthy cash flow -- means that it would likely benefit from a downturn. It is -- in short -- antifragile.

Winner = Veeva


Our second metric is a bit murkier. While there's no single metric that can tell you how "expensive" or "cheap" a stock is, we can consult more than one measurement to build out a more holistic picture.

Company P/E* P/FCF PEG Ratio
Veeva 82 48 2.3
Athenahealth 58 74 1.3

Data: Yahoo! Finance, E*Trade. *P/E presented using non-GAAP earnings figures.

Veeva and athenahealth are essentially tied when it comes to earnings and free cash flow ratios -- as each has a slight edge in one of the two. But when we throw growth rates into the equation (via the PEG Ratio), athenahealth emerges as a 40%-plus discount on the metric.

Winner = athenahealth

Sustainable competitive advantages

Finally, we have the most important -- and difficult to discern -- metric: sustainable competitive advantages, or "moats." At the most basic level, a moat is the special something that keeps customers coming back to one business -- and not the competition's -- for decades.

Both of these companies benefit from the moat of high switching costs. Once a pharmaceutical company -- for instance -- starts putting all of its sales force on Veeva Customer Relationship Management (CRM) and begins storing all of its clinical data on Veeva Vault, it would be loath to switch to a competitor. The costs -- financial, but also in terms of retraining staff, headaches, and the potential for losing critical data -- are just too high. 

Veeva's revenue retention rate in the last quarter was 121% -- which means not only that existing customers are sticking with Veeva, but they are using ever more services that the company offers, helping to raise switching costs even more.

Athenahealth is no slouch, either. While the switching costs don't necessarily revolve around equally sensitive material, healthcare providers are still reticent to switch away from a provider once they are signed on. One challenge the company faces that Veeva doesn't is that industry stalwart Cerner already has a huge swath of the market, and athenahealth has to deal with those same high switching costs it enjoys with current customers to convince potential customers to make the switch.

In the end, though, I consider this a draw. That's because athenahealth also has the ability to benefit from the network effect. As more and more providers sign on to AthenaOne, others are incentivized to join, as they can share medical records across the platform -- an important trait in today's mobile world. The number of providers using AthenaOne jumped 15% last quarter alone.

Winner = Tie

My winner is...

So there you have it, a tie. When this is the case, I normally use moat as the deciding factor. Since both companies were tied here as well, I go with where my skin is in the game. Since I own shares of Veeva -- but not athenahealth -- that means the nod goes -- ever so slightly -- to Veeva.

It's worth noting that I compared these two just five months ago and -- while Veeva came out ahead in both -- the gap between the two has narrowed considerably. Athenahealth's business seems to be back on track and Veeva's stock has gotten much pricier, making both worthy of your consideration today.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.