Americans are generally satisfied with their personal finances, but many lack confidence in their ability to afford retirement, an emergency expense or even their daily living costs.

Roughly two-thirds, 67%, describe their financial situation as generally good, up slightly from 62% who said so at the start of the year, according to a survey by The Associated Press-NORC Center for Public Affairs Research.

Their brighter economic outlook reflects in part a decade-long U.S. economic expansion that is now the longest on record. The expansion has slashed unemployment, revived the housing market and boosted overall household wealth. But some groups, especially young adults, racial minorities and the poor, say they remain financially insecure.

Their anxiety is among the consequences of the economic expansion, which has benefited the most affluent far more than it has others. The richest Americans now hold a greater share of the nation’s wealth than they did before the Great Recession began in 2007.

Housing and college costs have imposed a much heavier strain on today’s young adults than they did on older generations. And four decades of sluggish pay growth have depressed staring salaries for people who are beginning their careers.

Nearly four in 10 Americans say they lack confidence in their ability to pay an emergency expense of $1,000. At the same time, only about 1 in 10 say it’s very likely they wouldn’t pay the bill at all, even if it meant taking a loan, relying on a credit card or borrowing money from relatives.

Just two in 10 are very confident that they’ll have enough savings for retirement. Nearly half have little to no confidence.

A quarter of Americans say their expenses are rising faster than their incomes. Just 11% say their salaries have outpaced their costs. (The rest say their incomes have largely kept pace with expenses.)

Many older Americans have managed to build financial security through home ownership and traditional pensions, which most employers have now phased out. About three-quarters of those ages 60 and over report feeling good about their financial situations.

By contrast, four in 10 Americans under 30 describe their financial situation as poor. Half say they doubt their ability to handle an unplanned bill — twice the proportion of people ages 60 and older.

“Millennials are on a much lower path of wealth-building than their older predecessors,” said Reid Cramer, director of the millennials initiative at the New America Foundation, a Washington-based think tank.

The generational wealth gap that emerges from the survey coincides with findings last year by researchers at the St. Louis Federal Reserve. Those researchers studied six groups of families born between 1930s and the 1980s. The youngest group, they concluded, was essentially a “lost generation” for accumulating wealth.

The median family led by someone born in the 1980s had only two-thirds the wealth that earlier generations did at the same stage in life. The same study found that the median inflation-adjusted income for people younger than 40 had declined 10% since the Great Recession. By contrast, incomes for those older than 62 had jumped 24%.

Younger workers are not only earning less. They are also clustering in large cities, where many major employers have increasingly placed their jobs. This often means moving to neighborhoods with higher housing costs.

Joshua Beard, 35, recently left an information technology job in Loretto, Tennessee, whose population is under 2,000. That next job might have to be in someplace like Nashville or Huntsville, Alabama, where there are more opportunities in his field.

“I think I’ll be able to earn as much as I was getting before, as long as I’m willing to move to a bigger area,” Beard said.

If faced with an emergency expense, Beard said he would likely charge it to a credit card. Yet he sees the economy as solid.

With their disproportionately higher wealth, older Americans and those earning more than $100,000 are generally more confident about managing emergency expenses and retirement savings.

Richard Farr, a 75-year-old retired anesthesia technologist, said he was helped by the sale a year ago of his home in Seattle, where figures show home values have jumped 250% since 2000. Tech companies such as Amazon fueled explosive growth in the city. Farr moved to an over-55 community in Seattle and invested the proceeds from his home sale, in addition to collecting Social Security and a pension.

“I did OK,” Farr said. “Not as well as some of the others in real estate investing. But I’m not unhappy with my proceeds.”

Pensions represent another major generational difference.

Only 17% of private-sector workers last year had access to a traditional pension plan, according to the Bureau of Labor Statistics, down from 38% in 1980. Younger workers instead must typically rely on 401(k) and other retirement plans that require more of their own contributions, lack a guaranteed benefit and tend to be less generous than traditional pensions.

The AP-NORC survey also reveals significant differences in financial security based on race, ethnicity and education. African-Americans and Latinos are more likely than white adults to describe their financial situations as poor.

And nearly four in 10 adults without college degrees say they’re financially strained, compared with two in 10 college graduates who say so.

People’s views about their financial well-being appear to depend, at least in part, on which party controls the White House and Congress. About eight in 10 Republicans describe their financial situations as good, compared with about six in 10 Democrats who do. Nearly half of Republicans, but only about three in 10 Democrats, say they believe their financial situations will improve over the next year.

Christine James, 43, of McKeesport, Pennsylvania, who voted for Trump in 2016, said she regards the economy as healthy. But as a mother of two boys, ages 5 and 14, she has lived off income from the Social Security Disability program for the past seven years. Before being diagnosed with hypermobility disorder and seizure disorders, among other ailments, she held jobs in administrative and clerical work.

After the costs for rent, utilities, food, her car and her sons’ needs, there isn’t much left in case an emergency occurs. James figures the economy is mainly helping those with money in the stock market, rather than people like her.

“I grew up in a middle-class family,” she said. “It’s a middle-class neighborhood. But I don’t have a middle-class bank account.”

© The Associated Press. All rights reserved.