There are only a few investing days left in 2022, so let's make the most of them. How can we do that? By preparing our portfolios for the future with solid long-term holdings -- companies with strong earnings track records. And they should also have what it takes to keep earnings climbing over time.

Healthcare is a great place to find these players. That's because people need their products, no matter what the economy is doing. Let's check out two big pharmaceutical companies that offer exciting prospects in the months and years to come. You'll want to snap them up before 2023.

1. Pfizer

Pfizer (PFE 3.64%) has become a household name thanks to its development of Comirnaty, its coronavirus vaccine, and Paxlovid, a coronavirus treatment. Both products are bringing in billions of dollars in annual revenue. Though we're heading toward a post-pandemic world, this revenue isn't likely to disappear.

Coronavirus boosters might follow the path of the flu vaccine. That means a good share of the population might go for an annual jab. And people who do catch the virus probably will still flock to Paxlovid. In fact, Pfizer predicts these coronavirus products will continue to generate multibillion-dollar revenue for the foreseeable future.

Meanwhile, the cash generated through coronavirus product sales is helping Pfizer build revenue growth of the future. In the first nine months of this year, Pfizer invested $7.8 billion in research and development and $8 billion to complete business deals.

The company faces a patent cliff, meaning some of its biggest drugs will face competition in the coming years. But efforts today should keep Pfizer's revenue growing. It aims to launch 19 new products in the coming 18 months. And 15 of those products, developed in-house, could represent $20 billion in 2030 revenue.

Today, Pfizer is trading for 9 times trailing-12-month earnings. That's near its lowest levels over the past decade. So right now, before the new era of growth, is a good time to get in on this pharmaceutical stock.

2. Johnson & Johnson

There are three great reasons to buy Johnson & Johnson (JNJ 1.49%) right now. First, the stock is defying the bear market, and that suggests investors recognize J&J's potential.

The two other reasons: J&J believes in dividend growth, and the company is heading toward an important transition next year.

Let's talk about the dividend first. J&J is a Dividend King. That means it has increased its dividend annually for at least the past 50 years. This is great news for shareholders because it shows payout growth is important to J&J. And that means the company is likely to stick by this dividend policy.

Today, J&J pays an annual dividend of $4.52, for a yield of 2.57%. That's a higher yield than the 2.07% approximate average for the pharmaceutical industry, according to the New York University Stern School of Business.

Now, let's consider next year's big transition. J&J is spinning off its consumer health business into a entity called Kenvue. This is good news because consumer health is actually the smallest contributor to revenue and has the lowest growth among J&J's three businesses.

That leaves J&J with the stronger businesses of pharmaceuticals and medtech. These units' revenue climbed 9.2% and 8.1%, respectively, in the most recent quarter.

Today, J&J is trading for less than 20 times forward earnings estimates. This looks pretty reasonable considering its dividend increases and the new phase of earnings growth that lies ahead. And that's why now is the perfect time to get in on this story.