All three major pharmacy chains, CVS Health (CVS -0.22%), Walgreens Boots Alliance (WBA 0.57%), and Rite Aid (RAD -31.13%), have seen their shares drop over the past 12 months and so far this year.

The reason is simple -- the companies are seeing reduced earnings. With fewer people getting COVID-19 shots and picking up COVID-19 tests at pharmacies, their stores saw less foot traffic this past year. In certain markets, the companies also are seeing more "shrinkage," which is retail-speak for thefts. 

The three companies are also struggling with labor shortages that have led them, in some cases, to cut store hours. The companies say there's a shortage of trained pharmacists, and the pharmacists say the reason for that is their workload has never been higher, forcing many out of the business and prospective pharmacists into different fields.

However, pharmacy stocks in general remain solid long-term buys, like many healthcare stocks, because of the trend toward greater spending on medical needs. Let's see which of these three is the best buy and why. 

CVS Health doesn't need a checkup

CVS' shares are down 26% over the past year and more than 20% so far in 2023. That's despite what was a strong year overall. The company has spent big on acquisitions, and although it paid down $4.1 billion in debt last year, it still has a whopping $50.5 billion in long-term debt.

While its purchases may have scared investors, the company's financials show it is healthy enough to do such deals. CVS reported fourth-quarter and full-year 2022 earnings on Feb. 8, and revenue and earnings per share (EPS) were up for the quarter while revenue was up for the year.

Yearly revenue was reported as $322.5 billion, up 10.4%, and yearly EPS was $3.14, compared to $5.95 in 2021. Quarterly revenue was $83.8, up 9.5% year over year, while quarterly EPS was $1.75, compared to $0.98 in the prior-year quarter. In its guidance, the company said it expects 2023 EPS of $7.73 to $7.93. 

CVS operates more than 9,700 stores, but with its 1,100 in-store clinics and its ownership of Aetna, it is as much a healthcare services company as it is a retail pharmacy company. Ideally, its clinics and healthcare offerings can boost floor traffic and develop a customer ecosystem that helps its retail side as well.

The company has announced other additions to its healthcare services this year. On March 29, it completed its $8 billion purchase of Signify Health, which focuses on home healthcare with a network of 10,000 clinicians. On Feb. 8, CVS said it plans to spend $10.8 billion to buy Oak Street Health, a primary care company that focuses on seniors and has 160 centers across 21 states.

CVS raised its dividend by 10% late last year to $0.605, its second consecutive 10% increase. The dividend represents an above-average yield of around 3.26% and it is well covered with a payout ratio of only 22%.

WBA PE Ratio (Forward) Chart

WBA PE Ratio (Forward) data by YCharts

Walgreens had an earnings surprise

Walgreens Boots Alliance is nearly as big as CVS with roughly 9,000 stores. Its shares are down more than 7% in 2023. However, the stock had an upbeat second quarter, where it outpaced analysts' expectations.

Walgreens reported quarterly EPS of $0.81, down from $1.02 in the same quarter a year ago. It also reported adjusted EPS of $1.16, while the analysts' consensus was for $1.02 in adjusted EPS. Walgreens' revenue was listed as $34.9 billion, up 3% year over year, and outpacing analysts' predictions of $33.5 billion.

Investors were also happy that the company maintained its full-year EPS outlook of $4.45 to $4.65 even though that's down compared to $5.01 last year. At its current price, Walgreens is selling for a little more than 8 times earnings, a discount compared to its competitors.

Walgreens operates three segments: pharmacy, international, and U.S. healthcare. The last is where it is seeing the most growth. Through its majority stake in VillageMD, the company is delivering more healthcare offerings. There are 210 VillageMD clinics now located at Walgreens stores, and that number could easily grow thanks to VillageMD's acquisition of Summit Health and its 710 locations. In the second quarter, the company's U.S. healthcare segment reported $1.6 billion in revenue, up 220% year over year and even on a pro forma basis, up 30% year over year.

The company's dividend of $0.48 delivers a generous yield of 5.55%. The company has increased its quarterly dividend for 47 consecutive years. Despite the high yield, the payout ratio was only 59% in the last quarter, which may leave room for additional growth.

Rite Aid is struggling to be profitable

Rite Aid is the smallest of the three pharmacy companies with 2,310 stores in 17 states. Its shares have fallen more than 73% over the past year and more than 32% in 2023. 

The company reported fiscal 2022 third-quarter earnings on Dec. 21, and while they weren't impressive, they were better than expected. The company reported revenue of $6.08 billion, down 2% year over year, but better than analysts' estimates of $5.94 billion.

Rite Aid did post a $67.1 million loss in the quarter, equal to a loss of $1.23 in EPS, compared to a loss of $36.1 million, or a loss of $0.67 in EPS last year. CEO Heyward Donigan attributed the declines to tighter margins, seasonal markdowns, and increased shrinkage.

The company's full-year 2023 guidance estimates revenue to be between $23.7 billion and $24 billion, compared to $24.57 in fiscal 2022, and net losses of between $584 million and $551 million, compared to a net loss of $538.5 million in fiscal 2022.

Unlike the other two companies, Rite Aid does not offer a dividend.

WBA Revenue (Annual) Chart

WBA Revenue (Annual) data by YCharts

Not a simple choice

While CVS is showing the best fiscal health of the three stocks, its shares are also the priciest with a valuation of roughly 23 times earnings. Its dividend also doesn't have the history or yield that Walgreens' does. 

However, its valuation isn't that high when you consider the company's expected earnings this year and its head start in healthcare services over the other two companies. That gives CVS more economic diversity and it makes consumers more familiar with the company's brand. In the long run, CVS is a safer pick with less risk of a dividend cut or a large share drop.