If there is a state of inflammation in the intestinal tract, especially the colon, which could be caused by not just parasites, but bacterial infection, dietary sensitivities, pancreatic disease or other ailments, your dog may have the feeling of needing to defecate because of the inflammation alone despite there being no stool present (this is comparable to a person who experiences diarrhea and uses the toilet multiple times even though very little material comes out).