Why does my keyless remote entry/alarm reset itself?

I have a 2002 ford mustang. I have to program the remote to the cars factory alarm system every time. It will only stay programmed for an hour or less. It is not the remote because I've tested it on another ford vehicle and the battery is still good. Also the theft light sometimes stays on and sometimes it will blink.

If the light is blinking, you need to sync your key by turning it on for 1 minute without starting the motor, then turn back off for a few seconds and then turn on and wait and see if the flashing light is out and then go ahead and start. Repeat if necessary