BookmarkSubscribeRSS Feed
deleted_user
Not applicable
I have 100 oracle tables that I can access through SAS and I want to create a dataset for reporting purposes that contains the count of records, min, max for every column in the the table.

So if Oracle has a table with the following:

table xyz
name1 name 2 name 3
abc def hij
bca lmn


The sas dataset would have the following information
tablename columnname count min max
xyz name1 2 abc bca
xyz name2 1 def
xyz name3 2 hij lmn

I have all the tables columns and fieldnames in a datset already from a proc dataset. I am just not sure how to iterate through each column and set of a proc sql against the database to return the count min and max.

I have some code that comes close but not quite what I am trying to achieve.
1 REPLY 1
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Share the code you already have for feedback. Also, if you have the PROC DATASETS output then you also have access to the SAS view of the LIBNAME associated with the SAS datasets -- you can use the SAS DICTIONARY TABLES view facility to build a SAS dataset list of each table and the associated colums/variables in each table. Then with this information you can use SAS to generate PROC MEANS to get the MIN / MAX variable values within each SAS table.

Recommend searching the SAS support http://support.sas.com/ website for DICTIONARY TABLES views using PROC SQL (or the DATA step alternative being SASHELP.Vxxxxxxx members, such as SASHELP.VCOLUMN.

And you can either use SAS DATA step logic to generate the PROC MEANS code for each table, and capture the MEANS output to generate your desired info listed in your post.

The SAS support website not only as the SAS-hosted product documentation guides but also there are technical and conference topic-oriented papers that will help guide you.

Scott Barry
SBBWorks, Inc.

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
  • 1 reply
  • 956 views
  • 0 likes
  • 2 in conversation