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 ?
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.