Most of Wall Street has trouble holding stocks for a full quarter, let alone for several decades. But long-term holdings provide the best potential for wealth creation in the stock market.

Dividends can amplify those returns, too, as consistent reinvestment helps you accumulate more shares during bear markets like this one, laying the groundwork for bigger gains during the inevitable recovery.

With that in mind, let's look at two attractive stocks that have paid, and raised, their dividends for nearly a century between them. Read on for some good reasons to like PepsiCo (PEP -0.41%) and McDonald's (MCD -0.42%) stocks right now.

1. Buy Pepsi for income

PepsiCo stock hasn't fallen nearly as hard as the wider market in 2022, and there are excellent reasons for that outperformance. The consumer staples giant has been growing sales quickly even as people shift spending away from many less-essential categories. Organic sales are up a blazing 13% in the first half of the year, and earnings are rising, too.

Pepsi is finding room to raise prices, but it is also achieving higher volume in key niches like snack food, energy beverages, and breakfast. The stock is attracting investors who are looking for stability in what could be a volatile trading period ahead .

But the company was winning market share even before the pandemic, and right now it is extending that positive momentum into the post-pandemic period. Its gushing cash flow means shareholders can also look forward to $8 billion of direct returns in 2022, mostly through dividend payments. Pepsi has raised its annual payout for 50 consecutive years, and there's every reason to expect another boost ahead in early 2023.

2. Buy McDonald's for peace of mind

McDonald's has been raising its dividend for 45 consecutive years, and the fast-food titan has a good shot at many more decades of increases on the way. Sales easily eclipsed prior global records after pandemic lockdowns ended in most markets. Comparable-store sales were up 10% in the most recent quarter, in fact.

Sure, there are signs of stress on the business today. Comps were up just 4% in the U.S. market and management in July described the competitive environment as "challenging." Promotions are becoming more common as consumers' budgets tighten, and inflation is still pressuring earnings.

McDonald's is in a great position to ride out these challenges. It can pivot its menu to favor more value-focused products while relying on premium fare for higher margins. That flexibility is a key reason it sports an operating margin of over 40% of sales today, one of the highest around.

MCD Operating Margin (TTM) Chart

MCD Operating Margin (TTM) data by YCharts.

And the chain is entering the economic slowdown with plenty of cash, with operating cash flow at $2.8 billion through the first half of 2022 . Management is directing much of its excess cash toward investing in growth initiatives like its delivery service.

Constant improvements to its drive-through platform are helping keep rivals from winning market share, too. The burger giant has used this formula to help it maintain its industry leadership position for decades, and dividend investors have good reason to expect that impressive run to continue.