Introduction

2013 has been the year to own shares of Walgreen Company (NASDAQ:WBA). With shares up about 49.8%, compared to the S&P 500's 14.8%, investors who bought shares in the drugstore chain should be very happy thus far. Part of this rise has been attributable to the company's decision to build 374 Take Care Clinics in its stores over the past few years, up from 360 locations as of the end of its most recent fiscal year. Another contributor has been the company's number of drugstore locations, which has risen by 207 (or 2.6%) over the past year.

Perhaps the largest contributor to Walgreen's share price appreciation has been its large comparable store pharmacy sales growth. For instance, in September of this year compared to September of 2012, the company saw its comparable store pharmacy sales grow by 10.2%, primarily due to a 9.6% increase in prescriptions. In an era when brick and mortar businesses appear to be on the decline, it is surprising to see such attractive growth at a company that already has a large footprint that, last year alone, amounted to $71.6 billion in revenue.

Upon further investigation, it appears that the company actually has seen some decrease in customer traffic but this has been offset by an increase in the amount that each customer buys. Furthermore, the company received some help from the shift toward customers buying more generic drugs, which typically result in higher payouts on a per script basis.

Competition and valuation metrics

Beyond a doubt, these recent developments have proven beneficial for Walgreen. However, no company makes for a good investment if its price isn't right and if its margins are mediocre. For this reason, I decided to look at Walgreen and compare it to its two largest publicly traded peers in an effort to determine which drugstore offers more bang for your buck (or, I guess, more pills for your buck?). The companies in question are none other than CVS Caremark Corporation (NYSE:CVS), and Rite Aid Corporation (NYSE:RAD).

Looking at the profitability of each company, Walgreen has the second largest four-year average net profit margin of 3.3%. In juxtaposition, CVS, the largest of the three, posted a 3.4% margin. However, CVS has seen its profitability decline every year during the past four years from a high of 3.8% to 3.1%. Meanwhile, Rite Aid posted an average net profit margin of -1.3%, but it should be noted that this measure has improved almost every year and has risen to 0.5% as of the end of its 2012 fiscal year.

While the net profit margin for each company is fairly close, the return on equity for each company is very different. Walgreen, for example, saw a four-year average return on equity (which is the measure of how much money shareholders receive each year in return for each dollar invested) of 14.6%. This is significantly higher than the 9.7% posted for CVS. Interestingly enough, while Rite Aid saw a 2012 return on equity of -4.8%, it is impossible to calculate what its return on equity was in the preceding years as both net income (the numerator) and its book value of equity (the denominator) were negative, which would give a false positive measure. Needless to say though, while the metric has improved as Rite Aid's net income has moved into the green, it is still far worse than the company's peers.

Moving on to the balance sheet of each drugstore, Walgreen's current ratio, which is its current assets divided by its current liabilities, has averaged 1.53 over the past four years. However, this ratio has been on a consistent slide down to the current level of 1.30. This is acceptable, but the general deterioration may indicate future liquidity problems. Rite Aid, with the highest current ratio over this time horizon at 1.84, has seen a similar but far less drastic decline. CVS has the lowest (but most consistent) current ratio at 1.51.

Finally, we arrive at the free cash flow margin. Based on my calculations, the free cash flow margin for Walgreen averaged 3.7%, while CVS, which has enjoyed a rising margin, seems to be nipping at its feet at 3%. Rite Aid, again, looks unfavorable as its free cash flow margin clocked in at 0.1% (though it has shown signs of increasing, rising in fact to 1.7% at the end of 2012).

Foolish takeaway

According to the results of this analysis, Walgreen does appear to be the most fundamentally sound of the three, effectively grabbing first place (though very narrowly) in two of the four tests. However, CVS isn't too far behind in any particular measure, with the exception of return on equity. Of these companies, Rite Aid looks to be the worst, but I cannot stress enough that its improvement in recent years shows no signs of stopping, which could be valuable for investors.

Even with this knowledge, can it really be said that Walgreen's slightly superior metrics are worth paying for when CVS could very well be bought instead? Well, looking at the four-year revenue growth of 7.8% per annum and the 18 times earnings CVS trades at, and looking at the 4.2% per annum revenue growth and the 24.8 times earnings that Walgreen trades at, I have my reservations.

Daniel Jones has no position in any stocks mentioned. The Motley Fool has no position in any of the stocks mentioned. Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.