Why am I doing this? I never learn.
First, since the data sheet you linked has switches with a number of different encodings, it's impossible to determine if you bungled the switch choice.
Next, I don't know what's connected to PortA:1-4, but all of your if/then statements are setting some of the set high, with nothing ever setting them low.
Nope. Not gonna do it again. As I read your post to figure out what the heck you're trying to do, and how you know the code is going through each section, I'm totally lost. Until you can write a clear articulated question, with diagrams showing what's actually connected at the moment you run the code to what, no one will probably be able to help you.
Sorry. I have more rewarding things to do.