They will both reference the same dataset, if that is what you meant.
But they aren't the same thing at all.
_LAST_ is a keyword you can use in places where SAS syntax expects a dataset name.
SYSLAST is a macro variable. You can use it anywhere you would use a macro variable.
According to the documentation, they will deliver the same value. With %SYSLAST, take care of macro timing rules and the trailing blanks.
Generally I'm not a fan of _LAST_ or &SYSLAST, and I think it was a bad language design decision to have a PROC step default to reading _LAST_ if no dataset is specified.
It's part of the language so it's not going to change, but I would avoid relying on either.
That said, I think they really might be the same thing. I just noticed that if you assign a value the the macro variable SYSLAST, the value will be used by _LAST_, e.g.:
%let syslast=sashelp.class ;
proc print data=_last_(obs=3) ;
run ;
%let syslast=sashelp.shoes ;
proc print data=_last_(obs=3) ;
run ;
options _last_=sashelp.prdsale ;
%put &syslast ;
proc print ;
run ;
They will both reference the same dataset, if that is what you meant.
But they aren't the same thing at all.
_LAST_ is a keyword you can use in places where SAS syntax expects a dataset name.
SYSLAST is a macro variable. You can use it anywhere you would use a macro variable.
Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.
Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.