The practice of docking the tails of dogs dates back to at least the Roman Empire.
For most working dogs, the general reason for doing so is to prevent injuries to the tail.
In the mid 19th century, as the Yorkshire terrier breed developed in Great Britain, Yorkies were working dogs.