This year hasn't been great for Eli Lilly (LLY -1.00%), at least so far. For instance, the company has encountered regulatory obstacles for two important pipeline candidates: potential Alzheimer's disease (AD) therapy donanemab and investigational ulcerative colitis medicine mirikizumab. Both candidates failed to earn regulatory approval in the U.S. Furthermore, Eli Lilly's fourth-quarter update was not great.

Despite these issues, the company continues to beat the market. Is Eli Lilly stock a buy, even close to its 52-week high?

Eli Lilly's financial results should improve

It's essential to put the past couple of years in context. Like those of many other companies, Eli Lilly's financial results have been affected by pandemic-related factors. The drugmaker developed several coronavirus antibodies from which it generated solid sales. However, the company's revenue in this segment declined in 2022, coming in at $2 billion, 10% lower than the previous fiscal year.

Eli Lilly's COVID-19 antibody sales dropped by a substantially larger amount, 96% year over year, in the fourth quarter. These dynamics partly explain its relatively unimpressive results in 2022, but there are other factors. Most notably, the U.S. dollar strengthened last year, which decreased the value of international sales for multinational companies.

Revenue in 2022 increased by just 1% year over year to $28.5 billion. The pharma giant's top line climbed by 4% in constant currency, still not that impressive, but a better performance.

Thankfully, the problems Eli Lilly faced last year shouldn't last forever. Eventually, constant currency rates will stabilize, and the drugmaker's coronavirus antibody sales will stop impacting its financial results. That's why its quarterly update shouldn't be a dealbreaker for investors.

The pipeline looks strong despite the setbacks

The recent regulatory obstacles are also not as bad as they seem. First, donanemab failed to earn the green light from the FDA under the accelerated approval pathway. However, the agency only highlighted the lack of AD patients with 12 months of followup, which, oddly enough, might actually be a positive sign.

Eli Lilly is running a pivotal study for donanemab, for which it expects results sometime this year. Meanwhile, mirikizumab failed to earn approval due to manufacturing issues. That isn't ideal, but it isn't a dealbreaker, not by a long shot. The FDA didn't raise safety or efficacy concerns with mirikizumab, so it's unlikely that Eli Lilly will have to conduct more clinical trials. It's very likely that mirikizumab and donanemab will eventually hit the market despite the recent setbacks.

Overall, Eli Lilly's pipeline still looks strong. Last year, it earned approval for Mounjaro, a breakthrough therapy for type 2 diabetes. This medicine could earn plenty of additional indications in the coming years. Some analysts estimate it could hit peak annual sales of $25 billion. For context, rheumatoid arthritis drug Humira, one of the best-selling medicines in the industry's history, achieved peak annual sales of $21.2 billion.

The pipeline features other promising programs, including lebrikizumab, a potential therapy for atopic dermatitis (eczema) that could earn approval soon. There's also basal insulin Fc, an investigational weekly insulin product that could be a major improvement over the current daily option that most patients with diabetes are required to take.

The company's late-stage pipeline includes nearly two dozen programs, with many others in phase 1 or phase 2 studies. Those will allow it to grow its portfolio over the long run.

A solid stock to buy and hold

While Eli Lilly has seen its fair share of issues in the past few months, it has some important traits that lend themselves to long-term success for pharmaceutical companies. They include the ability to innovate and develop newer products, especially (though not only) in the field of diabetes care, where it's one of the leaders.

Revenue and earnings growth will improve once pandemic-related factors subside. And another thing that makes the stock even more attractive is its dividend profile; Eli Lilly has raised its payouts by 131% over the past 10 years. Plus, the stock has soundly beaten the market during the past year.

For investors willing to be patient, the drugmaker can deliver many more years of market-beating returns. That's why Eli Lilly's shares are a buy, even at close to their 52-week high.