Since in general you will need to execute LAGn() function call on every observation just do that and store the results somewhere that you can conditionally retrieve them.
data want;
set have ;
x_lag6 = lag6(x);
x_lag9 = lag9(x);
x_lag999 = lag999(x);
if entry=1 then new_var = x_lag6 ;
else if entry=2 then new_var=x_lag9;
else new_var=x_lag999;
run;
Provide a more complete description of what you are actually trying to do to see if there might be a better way to do what you want. Most likely one that does not use any of the LAGn() functions.