Anyone who hasn’t heard the healthy lifestyle message has to be living under a rock. But whether it’s the vegetable-hating inner child or the primal urge to conserve physical energy asserting itself, millions of middle-age Americans are having none of it.

Over the last 20 years, the share of Americans 40 to 74 who eat five fruits and vegetables a day has dropped to 26 percent from 42 percent, according to the latest analysis of an authoritative national survey on health and nutrition.

Moderate drinking — roughly one drink a day for women, two for men — increased to 51 percent from 40 percent, even as the number of abstainers went down, to 40 percent from 51 percent. (Advice is mixed on whether this is a healthy trend.)

And the number of smokers in the 40-to-74 group declined only slightly, to 26 percent from 27 percent.

The obesity rate increased to 36 percent from 28 percent. And 43 percent of Americans said they worked out at least 30 minutes three times a week, down from just over half.

“The results are disappointing and disturbing,” said the study’s lead author, Dr. Dana E. King, a professor of family medicine at the Medical University of South Carolina in Charleston.

Dr. King added that because fruits and vegetables are markers of a healthy diet, correlated with consumption of fat and fiber, “not eating them is reflective of a decline in diet over all over 18 years.”

The study, in the June issue of The American Journal of Medicine, compared results from two National Health and Nutrition Examination Surveys, in 2001-6 and 1988-94. The surveys, done regularly by the National Center for Health Statistics, include a physical examination; each included more than 7,000 respondents 40 to 74 years old.

Dr. King focused on middle-age adults because they are at greatest risk for heart disease, but was surprised that even those with diabetes, high blood pressure or high cholesterol were no more likely to adhere to healthy habits.

“I worry that some people are taking medication instead of following a healthy lifestyle,” he said. “You take a pill and say, ‘I’ll eat whatever I want, and my doctor says my cholesterol is fine.’ Your pill may be lowering your cholesterol, but it’s not doing the other 100 things that proper eating and exercise do for you.”

In some areas, men’s habits have deteriorated more than women’s. In the earlier period, 57 percent of men and 49 percent of women reported exercising three times a week; now both sexes are at 43 percent. The rate of obesity climbed similarly in both men and women.

Although the study did not address the underlying causes of these changes, some experts say men are less receptive than women to advice on nutrition and exercise. Longer commutes and more time spent on the computer have made for more sedentary lives, said Ross Brownson, professor of epidemiology at Washington University in St. Louis.

And Dr. Lori Mosca, director of preventive cardiology at NewYork-Presbyterian Hospital, said stress and depression might be taking a toll. “Most people know what they need to do, but they need to be confident they can actually make the changes and believe the changes will impact their health,” she said. “I think what we’re seeing is that people are giving up.”

Dr. King warned that the rise in unhealthy habits could lead to a costly surge in heart disease and other chronic ailments of the elderly. But he added, “The other half of this message is that changes in lifestyle can do so much good.”

Other studies have shown that people who adopted healthy behavior reduced their risk of heart disease and death by 35 percent in just four years. “So to those people who say it’s too late and won’t do any good — the exact opposite is true,” Dr. King said. “There’s a tremendous benefit in people of this age.”