Editor's note: After this article was written, Dollar General reported second-quarter earnings that showed it notched a 9% year-over-year increase in sales, leading it to raise its comparable-store sales guidance for the year to an increase of 4% to 4.5% from its previous outlook of 3% to 3.5%.

Even with the S&P 500 down 11% in 2022, there is still no better vehicle for creating wealth than investing in stocks. While one asset class or another might outperform stocks over short periods of time -- gold, for example, is down less than 5% year to date -- the long-term results prove that if you want to accumulate large amounts of wealth, investing in stocks is the way to go.

Deutsche Bank found that over the past 100 years, equities beat out gold by 5.6% per year, housing prices by 6.6%, Treasuries by 6.8%, and oil by 8.4% per year.

Smiling person sitting back with their feet up.

Image source: Getty Images.

There have been only two decades in which stocks have had negative returns: the Great Depression of the 1930s and again in the 2000s, when a combination of the Tech Wreck, 9/11, and the housing bubble bursting all conspired to sink the market, causing negative returns of 0.5% and 0.9%, respectively.

It's clear that for investors wanting the best chance at a comfortable retirement, investing in stocks and staying in the market for the long haul is the correct strategy. Here are two stocks you can consider holding for the next 20 years.

Disney

Ignore the big boost in subscriptions that Walt Disney (DIS -1.01%) just recorded to beat out Netflix (NFLX 1.74%) and become the biggest streaming service. We might have reached peak streaming, and Disney is already revising how big it thinks it can grow over the next few years. It reduced the number of global subscribers it thinks it will have across its streaming services by the end of fiscal 2024 from a range of 230 million to 260 million to between 215 million and 245 million.

We might see consolidation occur in streaming, which could still result in Disney being on top, but there's obviously more to the entertainment giant than streaming. Its theme parks are rolling along, with revenue soaring 70% in its fiscal third quarter to $7.4 billion, while operating income surged from $356 million to $2.2 billion. While its movie studio isn't making the same level of blockbuster films these days, it's still producing handsome profits.

There's nothing to suggest the synergies Disney realizes from each of its business arms won't keep feeding each other for years or even decades to come.

Wall Street expects Disney to grow earnings at a rate of 38% each year for the next five years and to grow revenue by 40% to $118 billion by the end of 2026. It's a flywheel business in which one division's success feeds greater wins in other segments in a positive feedback loop, making Disney's growth look effortless.

Dollar General

There are times when events cause a company to come into its own, and the inflationary era we're going through now is just such a period for Dollar General (DG -0.36%), the deep-discounting superstar that's hitting its stride with consumers.

Dollar General enables shoppers to stretch their budgets, and because it long ago made necessary investments in consumables -- including refrigerated and frozen foods and fresh produce -- customers are able to easily change their shopping habits.

In the fiscal first quarter, the deep discounter, like most other retailers, ran into supply chain headwinds, which led to a negligible decline in same-store sales. But the winning category was consumables, which saw a 9.1% jump in sales when every other category was down.

We saw this one time before, during the 2008 financial crisis, when consumers were forced to go downmarket to buy goods, and what happened afterward was that they didn't go back. They liked what they saw at the dollar chains and continued shopping there.

Despite the dip this past quarter, Dollar General is looking for better than 10% sales growth for the year and raised its comps guidance to a range of 3% to 3.5% from its previous forecast of 2.5% growth. It also expects to add 1,100 new stores this year.

The consumables business gets consumers returning again and again and spending, on average, a bit more. There's no time when saving money is not good, but it will particularly resonate with shoppers now. Dollar General is a business that can keep expanding for the next 20 years or more.