Look at the thread "Can you make name variables" a few days ago
https://www.picbasic.co.uk/forum/showthread.php?t=1419
ie
Code:
port var porta.0
....
case  X = 1  
        X = 2
        ...

SerOut2 port[X],baud,["output string",10,13]
I know this port referencing method doesnt always work with all commands, but its worth a try

Andrew