In other languages, like Visual Basic or FOCUS, you can write code that'll allow you to jump from one part of the code to another part. Can you do the same thing in a SP? i.e., ...If WOMBAT eq 1 then goto x else if WOMBAT = 2 then goto Z, else goto Y. Can that sort of thing be done?
You can look in the SAS Language documentation for how LINK works vs GO TO. I generally discourage the use of the GO TO statement in favor of making a LINK section. (I have written and maintained GO TO code in Fortran and Basic and it's too easy to write "spaghetti" code that is awful to maintain -- hence the reason I much prefer the LINK statement. I'm a big fan of maintainability.)
The nice thing about the LINK statement is that it could almost be considered like a separate sub-routine and control returns to where the LINK statement was issued (or more accurately, to the statement after where the LINK statement was issued. The GOTO statement on the other hand, returns control to the top of the DATA step program.
LINK provides you with a more structured programming approach to your logic. LINK and GOTO are both documented in a section entitled: "DATA Step Processing" --> "About DATA Step Execution".
Here's a program that illustrates using the LINK statement. Submit it from a code node in EG and then review the output. (Not intending for this program to be a stored process -- again, you need to understand how this works in "regular" SAS code and have a working program before you convert that program to be a stored process.)
** the code;
input name $ WOMBAT;
if WOMBAT = 1 then do;
else if WOMBAT = 2 then do;
BOTVAR = 'all the same';
MIDVAR = 'inside X';
MIDVAR = 'inside Y';
MIDVAR = 'inside Z';
WOMBAT2 = WOMBAT ** WOMBAT;
proc print data=stuff;
title 'MIDVAR will be different depending on the value of the WOMBAT var';
title2 'BOTVAR will be the same for everybody';