IT IS RARE enough that a government program succeeds in doing everything it set out to do. When one ends up doing far more than expected, it is time for some hearty congratulations. The program is Project Viking, NASA's exploration of the planet Mars, which should reach the end of its mission today or tomorrow.

The two Viking rockets were launched a few days apart five years ago. After a journey of 200 million miles, each reached Mars and ejected a landing station while the rest of the spacecraft continued to orbit the planet. This was the first successful attempt to land and operate an unmanned spacecraft on Mars; three previous Russian tries had failed.

But both Vikings landed safely, and though they had been designed for a 90-day mission life, both operated for four years. Their mere construction was an extraordinary achievement. Containing elaborate computers, two power stations, cameras, a weather station, two chemical laboratories, incubators for biological experiments and mechanical arms for digging and collecting soil samples, the whole thing had to be crammed into a few square feet and had to survive a rocket launch, a year's trip through space, sterilization (to avoid contaminating Mars) and the shock of landing on the Martian surface.

Together, the Viking landers and their orbiting companions have sent back a mass of information that will take years to analyze. Already, a great deal has been learned about Martian weather, the chemical composition of its atmosphere and its surface, the origin of the planet and of its two moons, and their past geological history. Nearly the entire planet has been mapped and photographed in detail. The photos show everything from huge canyons to volcanoes that dwarf Mount Everest, and many still inexplicatible geological formations.

Some of what has been learned was expected, some is startling and some has created major new puzzles. The soil greatly resembles Earth's and could support larger machines and human beings. The polar icecaps are frozen water, not dry ice (frozen carbon dioxide). The channels that crisscross the planet's surface seem to have been cut by running water that could not exist under Mars' current conditions. The sky is pink, not blue. The biological experiments produced no evidence of life as we know it, but did show perplexing types of chemical activity, for which there is as yet no explanation.

Sometime in the next day or so, the Viking 1 orbiter is expected to run out of steering gas, making further communication back and forth impossible. Since Viking 2 ran out of gas two years ago, the project will then be essentially over. By the time all of its results have been analyzed, it will have contributed to a better understanding of the nature of the planetary processes that underlie life on earth, as well as a detailed view of the planet most like our own in this still lonely universe.