user2462924
user2462924

Reputation: 75

how to get only first page of "proc contents" in SAS

I am trying to print out only first page of proc contents in my pdf file but I don't know how to do that. Can anybody help me? Thanks.

ods pdf file='/Output/output.pdf' bookmarklist=hide;
proc contents data=work._all_;
run;

Upvotes: 0

Views: 1095

Answers (2)

vasja
vasja

Reputation: 4792

Turn on ODS trace and run your original code to see the parts of ODS output with

ods trace on;


Output Added:
-------------
Name:       Directory
Label:      Directory Information
Template:   Base.Datasets.Directory
Path:       Contents.Directory
-------------

Output Added:
-------------
Name:       Members
Label:      Library Members
Template:   Base.Datasets.Members
Path:       Contents.Members

.....

Then make your selections or exclutions based on Name, Label etc. e.g.:

ods pdf select Directory Members Attributes Enginehost;

or

ods pdf exclude variables;
proc contents data=work._all_;
run;
ods pdf select all;

ods trace off;

Upvotes: 1

Joe
Joe

Reputation: 63424

ODS OUTPUT is your best way. You can use it like this:

ods output attributes=classattrib; *any name here is fine instead of classattrib;
proc contents data=sashelp.class;
run;
ods output close;

Now it's in a dataset and you can PROC PRINT or whatever the dataset.

You can see what the different parts are called using ODS TRACE; just put ODS TRACE ON; before a proc, then ODS TRACE OFF; after it (or whenever you want to stop getting the Trace output), and you can see what each table is called.

See this doc page for more information.

Upvotes: 0

Related Questions