BookmarkSubscribeRSS Feed
greg6363
Obsidian | Level 7
I was able to get access to a database but it contains 276 separate tables. In order to see what variables are in each table, I can use PROC CONTENTS to get a list of said variables but it’s too laborious to write a PROC CONTENTS statement for each table. Is it possible to create a macro with a macro variable called TABLE in order to call the name of each individual table from a list? Any assistance is appreciated. Thanks.
4 REPLIES 4
PaigeMiller
Diamond | Level 26

No macros needed.

 

Issue the proper LIBNAME statement to connect to this database. Then find the view named SASHELP.VCOLUMN and look at that. All the information about the variables and the tables in this database is in there.

--
Paige Miller
SASKiwi
PROC Star

What is your objective? To write queries of these tables or something else? What database are you accessing?

Astounding
PROC Star
PROC CONTENTS contains a shortcut for doing exactly what you want:

proc contents data=libname._all_ ;
run;
greg6363
Obsidian | Level 7
I thought you could only use the _all_ in a PUT statement. Let me give it a try. Thanks.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 935 views
  • 4 likes
  • 4 in conversation