Saspy Table Names in the Library

79 Views Asked by At

I want to use SASPy to put the names of tables within a library into a list as strings.

I tried this but sasdata() module does not work on my computer:

sas = saspy.SASsession()

tables = sas.sasdata(library=library_name).list_tables()

for table in tables:
    print(table)
1

There are 1 best solutions below

0
On BEST ANSWER

list_tables() is a method of the SAS session object. The way you're using this is not a valid use of sasdata(). The corrected code is below.

sas    = saspy.SASsession()
tables = sas.list_tables('sashelp')

for table, typ in tables:
    print(table)
AACOMP
AARFM
ADSMSG
AFMSG
AIR
AIRLINE
...