Hi everyone,
Does anyone know if it is possible to list all datasets/views which are created in a SAS EG session?
Ideally, the solution would work with notes turned off.
For example, if I called the following macro with a %include:
%macro create_dsets;
options nonotes;
data testa.dset1;
a=1;
run;
data testb.dset2;
b=1;
run;
%mend;
%create_dsets;
Can I then recall the datasets created in the session i.e. testa.dset1 testb.dset2?
Cheers,
Jordan
You can look at PROC SCAPROC to trace your programs out while you run them. The results aren't exactly what you want, but could be parsed to be what you want.
@jordanw1993 wrote:
Hi everyone,
Does anyone know if it is possible to list all datasets/views which are created in a SAS EG session?
Ideally, the solution would work with notes turned off.
For example, if I called the following macro with a %include:
%macro create_dsets;
options nonotes;
data testa.dset1;
a=1;
run;
data testb.dset2;
b=1;
run;
%mend;
%create_dsets;
Can I then recall the datasets created in the session i.e. testa.dset1 testb.dset2?
Cheers,
Jordan
You can look at PROC SCAPROC to trace your programs out while you run them. The results aren't exactly what you want, but could be parsed to be what you want.
@jordanw1993 wrote:
Hi everyone,
Does anyone know if it is possible to list all datasets/views which are created in a SAS EG session?
Ideally, the solution would work with notes turned off.
For example, if I called the following macro with a %include:
%macro create_dsets;
options nonotes;
data testa.dset1;
a=1;
run;
data testb.dset2;
b=1;
run;
%mend;
%create_dsets;
Can I then recall the datasets created in the session i.e. testa.dset1 testb.dset2?
Cheers,
Jordan
Did you try querying the dictionary tables (SASHELP.VTABLE or Dictionary.tables), this table has create date and modified date for the tables which might help you identify the tables created in your active session. SYSDATE and SYSTIME auto macros gives you when your system started.
I like your thinking but I believe your approach won't work anymore in cases where libraries get assigned and also de-assigned in code, where tables get created in a database, or where other people/jobs could write tables to a permanent library at the same time.
Use PROC PRINTTO; save LOG and parse it to get tables ?
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.