DATA Step, Macro, Functions and more

how we know library of a table

Reply
Frequent Contributor
Posts: 76

how we know library of a table

Kindly let me know how we know library name of a table by using base programing code.

Regards,

Ashwini

Super User
Posts: 10,018

how we know library of a table

An easy way is useing dictionary table.

proc sql;
 select libname,memname
  from dictionary.members
   where memname='CLASS';
quit;


Ksharp

Frequent Contributor
Posts: 76

how we know library of a table

Dear Ksharp,

If it table is an sql table then we use Dictionay.But i have table ,i don't know the library or location of table .I know only the name of table.How we can search a table by using base code.

Regard,

Ashwini

PROC Star
Posts: 7,467

how we know library of a table

What Ksharp referred to was a table of tables, not a sql specific table.

If you are talking about a table that is already in a libname that has already been assigned during a session, then his proposed code should accomplish what you want.

Super User
Posts: 10,018

how we know library of a table

As long as you know the name of table , the code you give you all the library name which contains the table name you want to search.

E.X.

If you want to find all the library which contain a table named 'CLASS' ,then the code below will list all the libraries.

proc sql;

select libname,memname

  from dictionary.members

   where memname='CLASS';

quit;

Ksharp

PROC Star
Posts: 7,467

how we know library of a table

While KSharp may have already answered your question, I'm not sure!  Is that what you meant or were you asking something else?

Ask a Question
Discussion stats
  • 5 replies
  • 155 views
  • 0 likes
  • 3 in conversation