More than a third of Americans have been forced to cut spending on essential items like food and utilities to afford housing, according to a Freddie Mac study.

About 42 percent of renters and 33 percent of homeowners have had to reduce the money spent on essentials to cover the cost of housing during the prior two years, the report said. Overall, 62 percent of renters and 47 percent of owners reported struggling to afford housing.

“Our research confirms much of what we see in our business every day — affordability remains the essential factor when it comes to determining whether to rent or purchase a home, and the cost of housing is having a significant impact on households of every age, size and location,” said David Brickman, president and incoming CEO of Freddie Mac, as Yahoo reports. “For millennials and many Gen Xers, buying a home is no longer just a decision based on housing and housing costs — increasing pressure from student loans and the rising cost of child care are having a significant impact.”

Freddie Mac conducted the online survey over a four-day period. The poll collected data from 4,040 respondents over the age of 18, including 2,864 homeowners, 1,119 renters and 57 others.

“While we tend to focus primarily on wages not keeping up with house prices and misperceptions of down payments, we should also recognize that for many millennials and Gen Xers, the basic cost of living has gone up,” says Brickman, as Yahoo cited. “Heavy burdens from student loans and the rapidly rising cost of child care are clearly affecting the housing decisions of these individuals.”

Student debt has more than doubled over the past decade to more than $1.6 trillion, according to the Federal Reserve. Of millennials who rent, 51 percent said they based their choice of housing on their student loan payments.

The cost of child care has also risen over the past 30 years, according to the report. About 31 percent of renters and 45 percent of homeowners reported choosing cheaper housing to afford daycare, according to Freddie Mac.

Over half of workers employed in such vital positions as healthcare, education and law enforcement have made housing decisions with their student loan repayment obligations in mind, the report noted.

About 35 percent of home owners who reported trouble affording housing in the last two years had to move to find a more affordable place to live, an increase of nine percent since last August.