From the Great Society to the Ownership Society, Richard P. Emery Jr. has been crunching numbers for the federal government.

The budget guru at the Office of Management and Budget began his federal employment in an era when many people believed government could do anything. He retired Friday as assistant director for budget review at a time when just as many think government is trying to do too much.

In many ways, Emery, 62, was the ultimate civil servant. As the senior career person at the OMB, he kept ideology -- and his political affiliations -- close to the vest. He focused instead on his nonpartisan convictions that every federal agency in any administration would like more money, and that his job was to ensure that the White House's priorities were met and that the numbers all added up.

"There is no constraint on the appetite for additional spending," Emery said Thursday in his half-packed office in the Eisenhower Executive Office Building. "That's true of agencies, it's true of Cabinet officials, it's true of politicians throughout the system, particularly in the United States Congress. So, what you find is our ongoing role is to be able to find the critical things that need to be funded and reduce those things that can be reduced."

It may sound, well, bureaucratic, but Emery clearly finds in his work a higher calling. "I see some significant merit in making the budget work effectively and doing as well as we can by the presidency," he said. "That is what we are supposed to do. It's sort of what I was trained to do."

In the federal government, the fortunes of the major parties wax and wane, and political stars rise and fall with every campaign season. Emery and other career civil servants are the consummate professionals who keep the agencies going, toiling away on important technical matters in the warrens of the federal bureaucracy, while the political appointees and elected officials push policy initiatives from center stage.

These days workers such as Emery are a retiring breed, if not a dying one. About half of the 1.8 million members of the federal civilian workforce are already eligible for regular or early retirement, and agencies worry about a potential exodus of talent. At the same time, fewer younger employees say they intend to stick with the government for their entire career.

Emery, whose thinning salt-and-pepper hair and soft-spoken demeanor give him the appearance of a laid-back college professor, closed out his 39-year career last week with a mixture of routine meetings on subjects such as electronic budgeting, annual agency award ceremonies and goodbye receptions in his honor. On his final afternoon, he visited eight offices for signatures verifying that he had turned in his gas mask, his travel card, his cell phone, his government ID card and other tools that every federal executive needs.

"You can't comprehend that you aren't going to be going through these doors again," Emery said Friday as he walked to an event at which he would hand out employee awards for "significant enhancement in the electronic distribution of overnight production reports" and other achievements. "It's hard to register. It seems like another day, except that it won't be."

Nancy S. Ridenour, chief of the budget review branch and a 30-year OMB employee, described her departing boss as "a technician without parallel in the budgeting world," who earned the trust of his employees by treating them with kindness and respect.

"He gets to know people, all of them -- every intern, every detailee," said Andrew M. Schoenbach, chief of the budget systems branch. "That personal warmth helps keep this division working under very trying times. He's the ultimate career civil servant. He can ask you to do something totally unreasonable, but he's doing it because it has to be done."

Emery's first federal job was in Venezuela, serving in the Peace Corps from 1965 to 1967 after he graduated from Wagner College on Staten Island. He left graduate studies in economics at New York University in 1968 after a professor told him that the Bureau of the Budget, the precursor to the OMB, was the most exciting place to work in Washington. But the bureau would not hire him.

Emery joined the Labor Department as a management trainee earning $8,436 a year and soon won a temporary assignment to the budget agency. In 1969, he landed a full-time job as a budget examiner scrutinizing education programs for the disadvantaged. He worked at the U.S. Office of Education from 1972 to 1975 and the Congressional Budget Office for 11 years before returning to the OMB in 1986.

Not many civil servants have been around longer. About 8,000 federal workers have a tenure of 40 years or more. The longest-serving, a program specialist at the Agriculture Department, has been on the job for more than 68 years, according to the Office of Personnel Management.

As head of the budget review division, Emery supervised a staff of 60 who collectively support the director of the OMB, providing budget estimates, giving strategic advice during budget negotiations and analyzing the fiscal implications of pending legislation. The division also helps guide all executive branch agencies in developing and implementing their budgets, and compiles all but the slimmest of the four volumes of the president's annual budget proposal.

Such work earned Emery $148,000 a year. It required he work 80-hour weeks during the busy times and 55-hour weeks during the slow ones.

"There's virtually no policy issue that the government addresses that does not ultimately get tied into a budget debate," he said with a genuine sense of accomplishment. "There are times when we have to identify gimmicks that the Congress is using or to construct a proposal to provide funding in a creative way."

Emery credits David A. Stockman, President Ronald Reagan's first budget director, with engineering the biggest and most enduring change in federal budgeting that he has seen in his long tenure. "Since 1981, we have shifted from a bottom-up budget to a top-down budget," Emery said. "Our primary concern today is not how much money we provide for an individual agency, but whether or not we can reduce the deficit in a timely fashion, whether we can address the long-term liabilities of the government in an effective way. I think it's a necessary shift."

For the first time in decades, Emery has the luxury of not having to think about numbers. On Aug. 5, he and his wife, Susan, and their two cats will leave their house in Rockville and set out for their new home near Las Cruces, N.M. He plans to keep a foot in his old world by working part time as a consultant to fledgling budget institutions in developing countries.

"I've enjoyed what I've done," Emery said. "I look forward to actually having a more relaxed schedule, but I'm not leaving at all because it has stopped being interesting. It continues to be interesting, and there are certainly a great many issues left to be solved. It's just the right time."

Richard P. Emery Jr., retiring as an assistant director at the Office of Management and Budget, gives out awards to staff members, including Diane Scott, right.