Sounds like he wants to irritate you by stinking up your carpet since his rear end is irritated.(just kidding) take him to a vet to see what the problem is.sounds like an infection of some kind.
When a dog scoots it is almost always because the anal glands are full and bothering them. Anal glands are scent glands that have small openings at 4 and 8 o'clock around the anus. They release a brown, smelly liquid that are for scenting. They are supposed to express (empty) these glands when they defecate. Many dogs do not empty their anal glands when they defecate and the liquid builds up in the glands. It can turn thick, and pasty then become infected. Most likely your dog needs to have these glands expressed. Your veterinarian can express these glands for you and show you how to do it at home. They are expressed by putting your index finger (with a glove on) inside the rectum and with your thumb on the outside feeling for these glands--they usually feel like a grape. Then gentle pressure is applied and directed toward you. Have a paper towel or gauze covering the opening--you don't want to get this stuff on you! You will need a holder as your dog will not sit still for this. It does not hurt--unless the glands are infected--but feels mildly uncomfortable. Intestinal parasites can occasionally cause the scooting but this is not common.