Sunday night Walter Mondale kept President Reagan on the defensive on economic issues for the entire length of the debate, despite the uncontested fact that a recovery from recession is -- as the president said -- in its 21st month. Reagan's effort to disgorge a succession of statistics worked to his disadvantage because Mondale, more adept, marshalled his own numbers in a more understandable way.

Mondale was able to pursue so well the question of the huge budget deficit that the president lost his poise, even to the point of asserting -- incorrectly -- that "Social Security has nothing to do with balancing a budget or erasing or lowering the deficit."

The president said that Social Security funds are kept in a separate trust fund -- which used to be the case. But for nearly 20 years, the nation has operated under the so-called "unified budget" in which all funds are commingled.

That's why Social Security has become such an issue, and why the president himself appointed the Greenspan Commission, which recommended changes in the system to reduce the potential drain of Social Security payments on the total national budget.

This gaffe is harder to excuse than the president's assertion that "there is no connection" between the budget deficit and high interest rates. This was a weak -- and boring -- response to Mondale's sober assessment that the deficit had pushed up interest rates and the dollar to unacceptable levels, interfering with American exports.

It was a regurgitation of a shallow analysis by Reagan's Treasury Department, which stands nakedly alone in its assessment. It is rejected, as Mondale snapped back, by almost every economist and businessman he knows. Mondale might also have noted that the "no connection" theory is rejected also by the World Bank, the International Monetary Fund, the Bank for International Settlements and the Organization for Economic Cooperation and Development in Paris.

Cleverly, Mondale introduced the question of fairness of the tax system by using Vice President George Bush's returns to allege that in 1983, using tax preferences, "one of the wealthiest Americans" paid taxes at the rate of only 12.8 percent.

"That way," confides a Mondale adviser, "Fritz was showing that the rich don't pay much taxes; and he was saying to Reagan: 'Your tax program helped these people get away with it.'

The president's response was ineffective on this point; in fact, he botched the opportunity to point out that Mondale had offered no tax reform plan, and that the Democrat's proposal to remove tax indexation would hit lower-income groups harder than the wealthy.

Reagan also failed to attack in other economic areas where Mondale is vulnerable. For example, Reagan might well have asked Mondale to produce specifics on about $8 billion worth of new "discretionary" spending cuts that he's included in his budget-reduction program.

Unless Mondale fudged, he would have had to admit that some of that will have to come out of Medicare and other entitlement programs. That would have taken the edge off Mondale's effective charge that Reagan had tried to cut $20 billion out of Medicare, after denying any such intention during the debate with Carter in 1980.

Reagan missed another good possibility by failing to challenge Mondale's restatement of his essentially protectionist position: it's one thing to complain, as Mondale did, that 1984 is "the worst trade year in American history." That shows the need to bring the dollar down by reducing the deficit.

But it's quite another thing to complain that these heavy deficits "are swamping the nation with cheap imports." Reagan has asserted that his administration believes in free and open trade. But his recent actions have been tainted with protectionism, and his failure to call Mondale on this issue indicates that he is making a "special interest" grab for votes in the "rust belt" not unlike Mondale's.