If you want to develop a skill like investing, it's usually a good idea to follow in the footsteps of folks who already know what they're doing. With a successful track record that spans nearly six decades, it's hard to find a better role model to emulate than Warren Buffett.

Buffett acquired Berkshire Hathaway for $14.86 per share in 1965, and since then shares of the holding company have increased by an average rate of 19.8% annually. Some money managers have outperformed Buffett over shorter time frames but nobody has been able to put up these kinds of numbers decade after decade.

Warren Buffett at a conference.

Image source: The Motley Fool.

Noticing his decades of success, many everyday investors are eager to know what he's buying and selling. According to disclosures that all large money managers must make to the U.S. Securities and Exchange Commission, we can see that Buffett completely closed out positions in Johnson & Johnson (JNJ -0.14%) and Proctor & Gamble (PG 0.24%) during the third quarter.

Both companies attract income-seeking investors with their legendary dividend programs. Let's look at the road ahead to see if dropping these stocks from your portfolio the way Buffett did makes sense right now.

Johnson & Johnson

Buffett closed out seven positions in the third quarter, and one of the most surprising was Johnson & Johnson. The healthcare conglomerate's dividend program is legendary with 61 consecutive years of annual dividend raises. At recent prices, it offers a 3% yield.

Despite a record of consistent dividend raises, Berkshire closed its J&J position in the third quarter by selling 327,100 shares. Buffett hasn't explained why, but I'd wager the recent spinoff of Kenvue was the deal breaker.

Kenvue was formed from J&J's old consumer goods segment. This August, J&J finalized Kenvue's separation and I wouldn't be surprised if Berkshire dropped its shares shortly after. Now that it no longer sells well-recognized brands like Listerine, Tylenol, and Band-Aid, an investment in this stock relies more heavily on its pharmaceutical and medical technology segments.

Buffett and Berkshire famously avoid investing in companies they don't understand well. There are a lot of ins and outs when it comes to medical technology, and the biopharmaceutical industry can be even more complicated. With this in mind, I wouldn't consider Berkshire's exit as a sign of a deeper problem at J&J.

If we ignore the effects of currency exchange, medtech sales jumped 10.4% year over year. Pharmaceuticals, which make up 65% of total revenue, had a rough quarter due to rapidly declining COVID-19 sales. Despite the challenge, J&J reported pharma sales that grew 4.4% year over year.

J&J recently submitted applications seeking approval for an experimental lung cancer therapy called lazertinib that could push pharma sales much higher in 2024. In a pivotal trial, patients treated with lazertinib in combination with Rybrevant, another J&J drug, were significantly less likely to experience disease progression compared to treatment with Tagrisso.

With $5.9 billion in annualized sales, Tagrisso is AstraZeneca's top-selling drug at the moment. Investors holding shares of J&J probably want to hold on at least long enough to see if lazertinib plus Rybrevant can take Tagrisso's place.

Proctor & Gamble

In the third quarter, Berkshire sold 315,400 Proctor & Gamble shares to close its position in the legendary consumer goods company. The sale was surprising because this company's dividend track record is even longer than J&J's.

Proctor & Gamble has paid a dividend every year since 1890, and this April it announced its 67th consecutive annual payout increase. At recent prices, it offers a 2.6% yield. This might not inspire anyone to buy the stock now but I wouldn't be in a hurry to let go either.

Proctor & Gamble recorded a very healthy $14.6 billion in free cash flow over the past year. It needed 62% of this sum to meet its dividend commitment. In other words, profits are more than sufficient to service its debt load and support future dividend raises in line with the company's overall growth rate.

Proctor & Gamble probably isn't going to be your portfolio's top performer, but steady gains seem likely. With a lineup of well-established brands that include Crest, Tide, and Pampers, the company was able to raise prices by 7% during its fiscal first quarter ended on Sept. 30. Sales volume over the same time frame came in just 1% lower.

Proctor & Gamble's brands gave the company enough pricing power to raise its dividend payout by 31% over the past five years. That isn't too bad, but rising interest expenses could make the next five years of dividend growth even less exciting.

Older investors who can't afford losses or declining dividends will want to hold on to this stock. For investors with a higher tolerance for risk, though, following Buffett's lead is probably the right move.