Write and run SAS programs in your web browser

How to Show First Table only in Proc Contents

Accepted Solution Solved
Reply
Contributor
Posts: 23
Accepted Solution

How to Show First Table only in Proc Contents

The requirement is: Use PROC CONTENTS to view the descriptor portion of each of the three data sets.
Include only the first table from each of the PROC CONTENTS output (the one with the
number of observations and variables) and don’t include the other two tables (engine data
and variable attributes) in the Report

Does anyone know what I need to add on proc contents and let it only shows the first table?


Accepted Solutions
Solution
‎07-09-2017 12:57 PM
SAS Employee
Posts: 115

Re: How to Show First Table only in Proc Contents

Use ods trace on to find the names of the tables.  Then use ods select to select the table(s) of interest.

 

ods trace on;
proc contents data=sashelp.iris;
   ods select attributes;
run;

View solution in original post


All Replies
Solution
‎07-09-2017 12:57 PM
SAS Employee
Posts: 115

Re: How to Show First Table only in Proc Contents

Use ods trace on to find the names of the tables.  Then use ods select to select the table(s) of interest.

 

ods trace on;
proc contents data=sashelp.iris;
   ods select attributes;
run;
Contributor
Posts: 23

Re: How to Show First Table only in Proc Contents

Thank you it works.

Super User
Super User
Posts: 6,498

Re: How to Show First Table only in Proc Contents

Of course you could just skip the PROC CONTENTS altogether and query the metadata yourself.

proc print data=sashelp.vtable ;
  where libname='WORK';
run;
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 195 views
  • 0 likes
  • 3 in conversation