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

Hello,

 

On our server, we have many libraries as well as many tables into it.  Some of those tables will be modify in the coming month.

As I am a new employee (5 months) and I am not familiar with all the sas programs and it became difficult to evaluate the impact of the table’s modifications on the existing programs.

 

I would like to know if there is a nice way to identify the libraries used in a program as well as the tables.

 

My goal is to set a list of the tables consulted in our programs by libraries.  As we are informed about which tables will be modified, it will be easier to estimate the potential impacts of those tables’ updates.

 

Thanks for in advanced for your help

Regards,

Alain

 

1 ACCEPTED SOLUTION

Accepted Solutions
mnjtrana
Pyrite | Level 9

If you are using SAS EG, i think there is no way to find out the libraries and the tables used int he program automatically, there is no in-built procedure.

 

However you can scan the whole code and find out which are the libraries and input or output.

 

other way could be to create a program which will read in your program as text file and create a dataset based on some keywords like - libname/filename/data/infile/merge etc.

 

In this way you could have some rows in the temp dataset which will show which libraries are there and corresponding tables, but it won't work sure shot for all input/outputs.

 

 

Filename inp "<path and name of the sas code/>";

data temp;
infile inp;
input rec $100.;
if index(lowcase(rec), "libname") ne 0 then output; /*check libraries */
else if index(lowcase(rec),"filename") ne 0 then output; /*check input files*/
else if index(lowcase(rec),"data") ne 0 and index(rec,".") ne 0 then output; /* to check the permanent datasets */
else if index(lowcase(rec),"merge") ne 0 and index(rec,".") ne o then output; /*check permanent datasets used in merge*/ run;

 


Cheers from India!

Manjeet

View solution in original post

4 REPLIES 4
mnjtrana
Pyrite | Level 9

If you are using SAS EG, i think there is no way to find out the libraries and the tables used int he program automatically, there is no in-built procedure.

 

However you can scan the whole code and find out which are the libraries and input or output.

 

other way could be to create a program which will read in your program as text file and create a dataset based on some keywords like - libname/filename/data/infile/merge etc.

 

In this way you could have some rows in the temp dataset which will show which libraries are there and corresponding tables, but it won't work sure shot for all input/outputs.

 

 

Filename inp "<path and name of the sas code/>";

data temp;
infile inp;
input rec $100.;
if index(lowcase(rec), "libname") ne 0 then output; /*check libraries */
else if index(lowcase(rec),"filename") ne 0 then output; /*check input files*/
else if index(lowcase(rec),"data") ne 0 and index(rec,".") ne 0 then output; /* to check the permanent datasets */
else if index(lowcase(rec),"merge") ne 0 and index(rec,".") ne o then output; /*check permanent datasets used in merge*/ run;

 


Cheers from India!

Manjeet
Ksharp
Super User
proc sql;
select libname,memname
 from dictionary.members
  where memtype='DATA';
quit;
mnjtrana
Pyrite | Level 9
Hi Ksharp,

I think, we would have to run the program once to be able to use the dictionary tables.

Also that program should be run in the new session, without any autoexec or autoallocated libraries, otherwise it would give list of all the datasets, not necessarily used in the program.

Thanks,
Manjeet

Cheers from India!

Manjeet
Reeza
Super User

Look at PROC SCAPROC - unfortunately it requires you to run the program to see what it’s doing. 

sas-innovate-2024.png

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.

 

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
  • 4 replies
  • 3146 views
  • 2 likes
  • 4 in conversation