I would like to reassign I/O pins to specific variables based on the state of an input pin. Can I do this? e.g.

If Input = 1 then
Variable1 = PORTB.1
else
Variable1 = PORTB.2
endif

But the above doesn't work. Is there another way? I would like to do this at the beginning of the program, just once.