We’re smarter together. Learn from this collection of community knowledge and add your expertise.

To get the latest dataset in the Library

by Regular Learner Anind_Sharma on ‎10-15-2014 02:27 AM - edited on ‎10-05-2015 03:36 PM by Community Manager (220 Views)

libname lib sqlsvr dsn=EIS schema=SYS user="username" password="password"  READBUFF=1000;

 

proc sql /*outobs=1*/ noprint;

create table a as select modify_date, NAME into :cif separated by ' '

from Libname.TABLES where NAME LIKE "table_name%" order by modify_date desc;

proc sort; by modify_date;

quit;

 

data _null_;

set a end=last;

if last;

call symput('outy',compress(name));

run;

 

Macro variable "OUTY" will contain the name of the latest dataset.

Your turn
Sign In!

Want to write an article? Sign in with your profile.


Looking for the Ask the Expert series? Find it in its new home: communities.sas.com/askexpert.