When a house is built on sloping ground, or when part of the back or side yard slopes sharply enough to cause soil washouts or flooding, a retaining wall often helps considerably.

A retaining wall may be only a few inches high - a low curb to keep banked soil from washing into a lower walk or driveway - or it may be several feet high to control a steep slope, but its basic function remains the same - to create two separate grades or levels so the ground on each level no longer forms a steep slope.

To accomplish this, soil will have to be dug out in front of the wall to regrade the lower level, and added to the back of the wall to keep flatten out and fill in the upper level. The greater the change in grade between the two levels, the more soil will have to be dug out and moved, and the higher and stronger the retaining wall will have to be.

When steep grades are involved (when a plot is located on the side of a hill, for example) it is often easier and chaper to build two small walls rather than one big one. Not only will less soil have to be moved, but the walls will be easier to erect and there will be less of a drop from one level to another.

Retaining walls can be built of many different materials - stone, brick, poured concrete or wood. The do-it-yourselfer will find a wood wall is the easiest to erect and wood the easiest material to work with.

Wood retaining walls can be built of old railroad ties or of rot-resistant conventional lumber (4x4s and 2x6s) treated to withstand attack by insects and moisture.

When a wall only a few inches high is needed, the simplest method is to place a few logs or railroad ties in place, then drive stakes next to them and nail the stakes to the logs or railroad ties. Scrape soil away first to create a level spot, then, after staking the wall in place, throw the excess soil (dug out from in front) in back of the wall and level it off approximately even with the top.

When something more than a simple curb is required, two construction methods may be followed. First, determine the height of the wall, where it will be located, and how high it will have to be to correct the difference in grade levels. As a rule, when doing the job yourself, it is best to go to no higher than about 3 to 4 feet with one retaining will - any wall higher than this calls for much more careful attention to design and stress factors, and will require the excavation and moving of much larger amounts of soil.

A wall built of railroad ties is often simpler to erect and involves little or no carpentry. Railroad ties are saturated with creosote or other preservatives, so they may be messy to handle (wear gloves). But you have nothing further to do to protect them against rot or attack by termintes. Because they are heavy, you may need a helper when placing and securing them.

After digging away the soil where the wall will be erected, start piling up the railroad ties. If the height of the wall is to be more than 18 inches it is a good idea to bury the bottom layer at least partway under-ground. This provides a footing that will be less likely to shift or slip when pressure builds up behind the wall.

As the railroad ties are piled one atop the other, each layer should be set back about an inch or so from the one below it so the overall effect will be to create a wall that slopes slightly backward along its exposed face. Each layer is secured to the one under it by driving in large spikes or nails. Use galvanized nails to prevent rusting.

All retaining walls will tend to catch or trap moisture that seeps down into the soil in back of the wall.This water can build up pressure that will cause the base of the wall to slip or shift, or it can cause washouts that will eventually undermine the retaining wall completely.

To prevent this, "weep holes" or drainage openings should be provided at regular intervals of six to eight feet so water can escape freely. This can be done by inserting short lengths of two-inch pipe through holes bored in the bottom layer of railroad ties, or the pieces of pipe can be inserted through gaps left between the ends of the individual lengths of wood (instead of butting one tightly against the next one).

When a retaining wall is more than three feet high, some means of securing it to the soil behind it is advisable; the method usually used is to install a "dead-man" type of anchor. This is a length of metal rod secured to the retaining wall at one end, with its other and fastened to a buried piece of timber or a large concrete block.

The rod is threaded at each end. After it goes through a hole drilled in one of the railroad ties a nut and large washer can be added to the outer end. Ther other end goes through the buried crossplace or "anchor" and is also secured by a nut. The dead-man anchor is installed before back-filling with earth behind the wall.

The other method illustrated for building a wood retaining wall uses either pressure-treated lumber or a rot-resistant species such as redwood, which is further protected by soaking each piece with wood preservative before assembling. As shown, 4x4 posts are erected first, spaced no more than four feet apart, and buried in the ground by as much as they stick up above the ground.

After the posts are up the 2x6 planks are nailed to the back side with rustproof nails, and an extra 2x6 is nailed across the tops of the posts to act as a cap that will help shed water and strengthen the structure. Drainage pipes should also be inserted at regular intervals to permit trapped water to escape, and if the wall is more than three feet high, a dead-man anchor should be installed at eight- to 10-foot intervals. CAPTION: Illustration 1, A retaining wall can be made of treated or rot-resistant 4x4 posts and 2x6 planks; Illustration 2, This retaining wall is made of railroad ties spiked on top of each other.