I have the following code
ods select Variables;
proc contents data=xmlout.&XML_DSET;
run;
The ods pdf open statement is earlier in the code
ods pdf file="&exceldir\README.pdf" startpage=never;
title 'README FILE';
This takes xmlout.&XML_DSET and nicely puts it in a pdf for me (the ods pdf close; is later on in the code).
However!
If I put varnum to order as variable exist in the dataset like so
ods select Variables;
proc contents data=xmlout.&XML_DSET varnum;
run;
The pdf does not display the results at all!
What am I doing wrong?
Thanks!
Looks like when you add the VARNUM option, the VARIABLES output object is not created, instead an output object named POSITION is created. The easiest way to find the different objects produced by a procedure is to use ODS TRACE:
52 ods trace on;
53 proc contents data=sashelp.class;
54 run;
Output Added:
-------------
Name: Attributes
Label: Attributes
Template: Base.Contents.Attributes
Path: Contents.DataSet.Attributes
-------------
Output Added:
-------------
Name: EngineHost
Label: Engine/Host Information
Template: Base.Contents.EngineHost
Path: Contents.DataSet.EngineHost
-------------
Output Added:
-------------
Name: Variables
Label: Variables
Template: Base.Contents.Variables
Path: Contents.DataSet.Variables
-------------
55
56 proc contents data=sashelp.class varnum;
57 run;
Output Added:
-------------
Name: Attributes
Label: Attributes
Template: Base.Contents.Attributes
Path: Contents.DataSet.Attributes
-------------
Output Added:
-------------
Name: EngineHost
Label: Engine/Host Information
Template: Base.Contents.EngineHost
Path: Contents.DataSet.EngineHost
-------------
Output Added:
-------------
Name: Position
Label: Varnum
Template: Base.Contents.Position
Path: Contents.DataSet.Position
-------------
58 ods trace off;
Seeing that, you can change your code to SELECT the Position output object, i.e.:
ods select position;
proc contents data=sashelp.class varnum;
run;
ods select all;