Is he neutered? Even if he is neutered, could be that he is still marking.
I believe Yorkies in particular respond much better to positive reinforcement training rather than punishment. I correct my boys, but I focus on encouraging them and enabling them to do the right thing -- especially when it comes to potty habits.
Make sure to give him ample opportunity to go outdoors and praise and reward. My boys are 6 and 7 and we still praise and make a big deal out of correct potty habits. They get 2 pieces of kibble for each good potty, so they are happy to go where they are supposed to and they milk the system

(we also use piddle pads in addition to outdoors).