Technology and e-commerce have transformed retail in the past decade. Many see e-commerce as the future, and experts have wondered if the brick-and-mortar retail location is becoming a thing of the past.

However, it may not boil down to a simple fight between e-commerce and physical locations. The key to success seems to be the ability to transform your business to accommodate the changing customer base in the long term.

When Macy's announced last month they were closing almost 40 locations, it came as a surprise to many. Why would a successful department store close so many locations? Then, Wal-Mart announced their intention to close 154 U.S. locations — again, a complete surprise as Wal-Mart has taken over and transformed the retail world in many ways. At the same time Macy's and Wal-Mart announced their closings, Amazon opened its first brick-and-mortar retail location in Seattle.

So, if e-commerce is shutting down brick-and-mortar locations, why did Amazon open one? Because, the future is not just e-commerce; e-commerce and brick-and-mortar locations need to work in sync.

What did cause retailers to close certain locations, then? The answer is all in the data.

Closing locations save retailers in the future

Wal-Mart's announcement was shocking, but the reasoning is logical and profitable. Big data showed Wal-Mart which locations were unsuccessful and should be closed. Closing unsuccessful locations allows Wal-Mart to focus on quality and adjust to their changing customer base.

"More than 95 percent of the closed U.S. stores are within 10 miles of another Wal-Mart store," according to CNBC.

Many of these closings appear to be more of a consolidation. In addition, Wal-Mart is not closing stores and questioning the upcoming quarter or year; they still plan to open Supercenters and Neighborhood Markets this year. Wal-Mart is also not closing locations based on overall problems and failures, rather a step toward the future.

Macy's also is taking a proactive step toward the future. Big data showed Macy's the unsuccessful locations, and they decided to close these to focus on improvements.

"In some cases, there will be short-term pain as we tighten our belt and realign our resources," said Terry J. Lundgren, chairman and chief executive at Macy's Inc. in a statement. "But our eye is on a long-term vision of Macy's Inc. as a dynamic retailer that serves existing customers and acquires new ones through innovative approaches."

Brick-and-mortar locations provide customer experiences

Amazon is king of e-commerce. They transformed the e-commerce world just like Wal-Mart shook up the brick-and-mortar retail world. But Amazon recently took the leap into the physical world with Amazon Books in Seattle. The success of the store can't be accurately determined with only a few months of sales, but recent job postings signal positive changes.

In addition to Amazon Books, universities around the country have opened physical locations for pickup and returns. Even though these locations aren’t focused on retail, they provide the customer experience that millennials desire.

These changes signify Amazon's ability to adapt to the customer's wants and needs with long-term changes. In addition, Re/Code stated Steve Kessel, a longtime executive whose team launched the first Kindle e-reader, is behind a large retail initiative focusing on physical retail happening at Amazon. The merge of e-commerce and physical retail is happening.

Opening or closing a location isn't always the fix

Not every retailer can just pick their least profitable location and close it. Not every retailer can just open up a brick-and-mortar location in a highly successful area. These are not always options. Some, like Target and Kohl's, according to CNBC, are focusing on smaller locations. Others are adapting their current locations to fit the changing need.

If you are considering closing one of your locations, always consider the possible consequences: the lost sales, the lost customer base, the physical location whether owned or rented there are legal obligations and the reputation that could follow.

It's not so much about Amazon versus the retail world; it's about all companies thinking long term. Amazon is opening physical locations because they see a long-term need. Wal-Mart and Macy's are using big data and analytics to determine which locations are unprofitable and have a low probability of becoming profitable.

The ability to adapt to change is necessary for long-term success. With access to practically endless data detailing your business, decisions can be made for long-term success. Put your data to work to determine long-term plans for success it might not be what you think.