Let's start with the table (from there you can implement it different ways):

1 = B0+B4 = 00010001b = 11h
2 = B0+B5 = 00100001b = 21h
3 = B0+B6 = 01000001b = 41h
A = B0+B7 = 10000001b = 81h
4 = B1+B4 = 12h
5 = B1+B5 = 22h
6 = B1+B6 = 42h
B = B1+B7 = 82h
7 = B2+B4 = 14h
8 = B2+B5 = 24h
9 = B2+B6 = 44h
C = B2+B7 = 84h
* = B3+B4 = 18h
0 = B3+B5 = 28h
# = B3+B6 = 48h
D = B3+B7 = 88h

Ok, table is done.

Now to use the lookdown / lookup method you build it like this:
{
*POLL / READ PORT B into keypad
*byte variable position
*byte variable position
LOOKDOWN keypad, [$11,$21,$41,$81,$12,$22,$42,$82,$14,$24,$44,$84,$1 8,$28,$48,$88], position
*this gives you the location in the table for the numeric representation of the character selected and puts it in 'position'*
LOOKUP position,["123A456B789C*0#D"],codeX
*this gives you the actual character selected and puts it in 'codeX'*
}

You then poll the keypad for the next characters in sequence.

The same applies to your, IF-THEN-ELSE routine. You can use it, but you should've built the table. Then you do something like:
IF PORTB = $11 then codeX = "1" etc...

Hope this helps, I am no expert and surely my hex is pretty rusty. But you should also get good guidance from some pretty smart people around here.

A good read before you even begin to tinker with PBP (in my opinion) is the BasicStamp manual. You will not get any better documentation since that is where it all started, and it is so widely used that each command is explained with great detail. The commands unique to PBP are obviously not in it, but most are (this is one of them).

Good luck.