BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jordanw1993
Fluorite | Level 6

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

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

 


 

View solution in original post

6 REPLIES 6
Reeza
Super User

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

 


 

jordanw1993
Fluorite | Level 6
Thanks for that, it's a great starting off point!
SuryaKiran
Meteorite | Level 14

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. 

Thanks,
Suryakiran
Patrick
Opal | Level 21

@SuryaKiran

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.

Ksharp
Super User

Use PROC PRINTTO; save LOG and parse it to get tables ?

Patrick
Opal | Level 21

@Ksharp

I'd use Proc Scaproc as @Reeza suggests as this will already do quite a bit of log parsing for you.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 6 replies
  • 1478 views
  • 6 likes
  • 5 in conversation