President Reagan signed the final six appropriations bills needed to keep the government in business Saturday, saying Congress deserved "a pat on the back" for passing the legislation in near-historic fashion.

Just shy of the official start of fiscal 1989 and a 40-year first, Reagan said, "It was touch and go for a while whether we would actually meet the deadline."I'm happy to report that today, October 1st, marks the beginning of the new fiscal year and at this hour, for the first time in years, all the government's budgetary work is done," Reagan said in his weekly radio address broadcast from the Oval Office. "The last of the government's 13 appropriations bills have been delivered to me and I have signed them."

The president was caught by surprise when Congress passed the bills just minutes before the fiscal year began at midnight. Just back from a Chicago campaign swing, he did not wait up to sign them in a ceremony, as planned.

But Congress barely made the midnight deadline, passing the last of the bills, the $14.3 billion foreign aid money measure, at 11:57 p.m. EDT.

"I hope the last 24 hours prove historic and mark the end of the `Perils of Pauline' budget games Congress has played for so long," Reagan said after signing the final six bills without fanfare.

It was the first time since 1977 that Congress had approved all 13 money bills before the end of the fiscal year, and it would have marked the first time since 1948 if the president had signed them before midnight Friday.

Delivering the Democratic response to Reagan's radio address, House Majority Leader Thomas Foley, D-Wash., praised Congress, saying: "The spending cuts in these bills will enable Congress to meet the goals of last year's budget summit.

"It also enables the Congress to cut the budget deficit by some $70 billion over the last two years," he said, adding that the 1989 deficit will be about 20 percent less than it would have been without congressional budget action.

Congressional leaders were jubilant at their achievement Friday night, with Rep. Silvio Conte, R-Mass., saying, "Today is a historic day of Olympic proportions. Today is a day that shatters myths, counters our critics and ends many winters of discontent . . . for the first time in the modern era the federal budget is in place, on time."