Wouldn't that work as well:

%macro getEngine(libref);
proc sql noprint;
select max(engine) into :engine
from SASHELP.VLIBNAM
where upper(libname) = upper("&libref.")
;
quit;
%put &libref. ENGINE is &engine.;
%mend;