Please see the following.
Because "Relationship" is missing, the codes is trying to make the best guess based on X. But at the place where the codes checks on X, X is not a valid column yet, in this case. So, providing complete information, the codes don't need to walk into the trap.
 
Names Default To Here(1);
dt = Open( "$sample_data/big class.jmp" );
x_var = "sex";
y_var = "weight";
obj1 = dt << Fit Life by X(
	Distribution( Weibull ),
	Relationship( Location and Scale ),
	Nested Model Tests( Location and Scale ),
	Y( Eval(y_var) ),
	X( :sex ),
);
wait(2);
obj2 = dt << Fit Life by X(
	Distribution( Weibull ),
	Relationship( Location and Scale ),
	Nested Model Tests( Location and Scale ),
	Y( :weight ),
	X( Eval(x_var) ),
);