A lot of hams are already cooked and need to just be heated up before you eat the ham however there might be some ham that needs cooked before eating but the hams I always buy are already cooked and ready to eat.
You can however keep a ham in the refrigerator for up to 4 days before you cook it and eat it.
If you're not gonna cook or eat the ham within 3 days then I would recommend you freeze the ham instead so that it will keep it longer.
When frozen the ham can keep for 6 months or longer but when just in the refrigerator the ham will last up to 4 days.