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 ?
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.