我有以下代码
ods select Variables;
proc contents data=xmlout.&XML_DSET;
run;
Run Code Online (Sandbox Code Playgroud)
ods pdf open语句在代码中较早
ods pdf file="&exceldir\README.pdf" startpage=never;
title 'README FILE';
Run Code Online (Sandbox Code Playgroud)
这需要xmlout.&XML_DSET并且很好地将它放在pdf中(ods pdf close;稍后在代码中).
然而!
如果我把varnum按顺序放在数据集中就像变量一样存在
ods select Variables;
proc contents data=xmlout.&XML_DSET varnum;
run;
Run Code Online (Sandbox Code Playgroud)
pdf根本不显示结果!
我究竟做错了什么?
谢谢!
看起来当您添加VARNUM选项时,不会创建VARIABLES输出对象,而是创建名为POSITION的输出对象.查找过程生成的不同对象的最简单方法是使用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;
Run Code Online (Sandbox Code Playgroud)
看到这一点,您可以将代码更改为SELECT the Position输出对象,即:
ods select position;
proc contents data=sashelp.class varnum;
run;
ods select all;
Run Code Online (Sandbox Code Playgroud)