Keeping calm during the market's ups and downs can be easier said than done when headlines are dominated by the political strife and the lingering potential for default on the United States' debt. However, as always, the last week has shown why it's important not to let daily news items spook you out of your investment strategy.

Those investors who got nervous lost sight of their long-term goals and exited the market amid uncertainty will have missed out on Wednesday's market rally. The same was true of past pullbacks and even larger downturns such as the global financial crisis.

The moral of the story? Stay calm, turn off the news, and concentrate on establishing a portfolio to weather market volatility.

A long-term strategy
If you want to build a portfolio that will help you sleep at night despite market ups and downs, focus on solid businesses with real value. You'll also be rewarded with share price appreciation, dividends, and share repurchases.

A good way to start is to look at some basic human needs like groceries and trash disposal.

For example, take Procter and Gamble (PG -0.59%). A world-class business with a market cap of more than $215 billion, it has a host of 50 flagship brands, including Gillette razors, Pampers diapers, and Head and Shoulders shampoo. These 50 "Leadership Brands" account for 90% of the company's revenue and more than 90% of its profit.

Not only are these brands household names, but they are also consumer staples. So no matter the economic climate, millions of consumers will go on buying P&G's products every day.This translates into a reliable income check for shareholders, with P&G currently paying an annual income of $2.41 per share for a yield of 3%. In fact, this year marks 123 years of consecutive dividend payments and the 57 straight annual dividend increases.

In addition, P&G has proven leadership. Well-respected former CEO A. G. Lafley returned to the company on June 30. Lafley ran the company from 2000 to 2009 and managed to double sales during this time. So with him at the reigns again, experts believe the company can further improve its position, using its size and marketing muscle to innovate, increase acquisitions, and further expand into emerging markets.

Another great example is Waste Management (WM -0.32%). With a market cap of $19.9 billion and more than 21 million customers, it is the largest trash-collector and processor of waste in the U.S. It has an extremely reliable income, holding multiyear trash-disposal contracts with a host of governments and commercial customers. This gives it an impressive dividend history: It has made reliable payments over the last nine years and currently yields 3.4%.

In addition, Waste Management benefits from high barriers to entry. Its sheer size gives it powerful economies of scale, while high start-up costs make it difficult for new companies to enter the field.

Look for long-term trends
Another good way to invest for the long term is to think about ongoing trends. This could mean social media, online shopping, organic food, or an aging population. Ask yourself what companies are most likely to profit from these trends. Think of stable companies with a good track record, strong and consistent leadership, and a healthy balance sheet.

One such example is Whole Foods (WFM). With a market cap of more than $23 billion, it is the largest chain in the organic-food space, meaning it is uniquely positioned to cash in on the organic-food boom in the U.S. and around the world. Nutrition Business Journal has predicted that consumer sales of natural and organic food in the U.S. will grow 10% per year in the next seven years.

With a diverse product range (across food, beverages, supplements, and body care), a loyal customer base, and a 30-year history, Whole Foods is well-placed to continue riding this trend through both increasing sales and new store openings in the U.S. and other developed markets around the world. With 364 stores, the company is continuing to grow at a rapid rate, with new stores already opened in Canada and the U.K. and, according to its website, 80 more stores currently in development.

Foolish takeaway
With a market rally reflecting renewed investor confidence following the extension of the debt ceiling on Wednesday, many high-quality stocks have reached one-year highs. So it's no surprise that shares Proctor and Gamble, Waste Management, and particularly Whole Foods are commanding a premium right now.

That being said, when it comes to building a long-term portfolio -- and often, the sooner you start, the better -- they are the kind of stocks you should consider buying to help you weather the storm. That way when the next market scare rears its ugly head, you can remember why you chose your stocks in the first place -- and if that hasn't changed, stay zen.