There is no cheat code for a dog in GTA San Andreas. The game has no pet mechanics.
Warning: Modding PS2 requires a modchip, FreeMCBoot, or swap trick; risky for beginners. PC version is far easier to mod.
Enjoy the vanilla game or explore mods on PC for a canine companion.