BookmarkSubscribeRSS Feed

I would like to suggest adding the ability to customize the fields that are output for Proc Contents. Often times I'm using Proc Contents Data = Libname._All_ NODS to get a list of tables that potentially need to be cleaned up. While the default fields are helpful it's just not enough info. For example, I would like to know if the table is compressed so I know if the size of the table can be reduced and I want to know who the owner is so I know who I need to contact if tables are identified as delete or archive candidates. I tried creating a table of the Proc Contents output but the owner is not included in the list of fields which is super frustrating. Often times the list of tables when not using the NODS option is so long I can't open it in EG which can make tracking down the owner info frustrating. So, in particular, I would like the owner field added to the output when creating a table (Out = option). However, if we could customize the NODS fields or if the owner and compress fields were added to the existing fields that are output when using the NODS option that would be awesome! 

SAS Employee

Hi, rileyd. I believe this is already possible using ODS output. Please have a look at the program below and see if it does what you need. Of course, change the libname statement to reflect your environment.


libname mylib base 'your location';

/* make sure not to create these files in the mylib library */
ods output attributes=atr( keep=  label1 cvalue1
                           where=( Label1='Data Set Name' )
                           rename=( cValue1=DataSetName ));
ods output attributes=atr1( keep= label2 cvalue2
                           where=( Label2='Compressed')
                           rename=( cValue2=Compressed ));
ods output EngineHost=atr2( keep=label1 cValue1
                           where=(Label1='Owner Name')
                           rename=( cValue1=Owner ));

proc contents data=mylib._all_;run;

data finalatr;
  merge atr(drop=label1) atr1(drop=label2) atr2(drop=label1);

proc print data=finalatr;run;
Quartz | Level 8

Hey DianeOlson,


Thanks for sharing - it works! I've used ODs before but didn't realize I could use it like this. Very cool! Also, great to learn something new that I can add to my toolbox.