Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sas 过程报告-在每页的第一行打印ID_Sas_Proc Report - Fatal编程技术网

Sas 过程报告-在每页的第一行打印ID

Sas 过程报告-在每页的第一行打印ID,sas,proc-report,Sas,Proc Report,我正在报告数据子组的大量值列表。我有我目前想要的格式的数据,只是做了一个表面上的改变。我试图找到一种方法,在每一页的第一行打印子组的值,但其余的值为空 我尝试了多种方法,使用define中的ID选项、使用compute after块、compute after\u page、分页列和使用by语句,但我无法用这些方法维护数据的结构 以下是一些示例数据和基本过程报告: /* basic data */ data test; input ID $ variable1 $ variable2 $;

我正在报告数据子组的大量值列表。我有我目前想要的格式的数据,只是做了一个表面上的改变。我试图找到一种方法,在每一页的第一行打印子组的值,但其余的值为空

我尝试了多种方法,使用
define
中的
ID
选项、使用
compute after
块、
compute after\u page
、分页列和使用
by
语句,但我无法用这些方法维护数据的结构

以下是一些示例数据和基本过程报告:

/* basic data */
data test;
  input ID $ variable1 $ variable2 $;
  datalines;
A Lemon Yellow
A Orange Red
A Lemon Blue
A Apple Green
A Lemon Yellow
A Orange Red
A Lemon Blue
A Apple Green
A Lemon Yellow
A Orange Pink
A Lemon Blue
A Apple Red
B Lemon Yellow
B Orange Red
B Lemon Blue
B Apple Green
B Lemon Yellow
B Orange Red
B Lemon Blue
B Apple Green
B Lemon Yellow
B Orange Pink
B Lemon Blue
B Apple Red
;
run;

/* output several times to cover multiple pages */
data test2;
set test;
if id = "A" then do;
output;
output;
output;
end;

output;
run;

/* proc report */
ods pdf;
proc report data = test2  nocenter nowd ;

define ID / order id ;
define variable1 / display;
define variable2 /display;

compute after ID;
  line '';
  endcomp;

run;
ods pdf close;
因此,在本例中,A和B的值在多个页面上运行。我希望A和B出现在他们的第一次观察中,第一次观察出现在新的页面上


我们将一如既往地感谢您的帮助。

我们不清楚您到底想要什么,但这里有一些选择

第一:
在页面之前计算。这可以让你把它作为第一个单元格放在表中,但是看起来有点。。。奇怪

第二:通过
组定义一个
。在
by
组的开头打印它

*COMPUTE BEFORE _PAGE_ option;

ods pdf file="c:\temp\test.pdf";
proc report data = test2  nocenter nowd ;

define ID / order id ;
define variable1 / display;
define variable2 /display;

compute after ID;
  line '';
  endcomp;

compute before _page_;  *prints ID here - can add more text if you want;
  line ID $;
endcomp;

run;
ods pdf close;


*BY groups;

ods pdf file="c:\temp\test.pdf" startpage=never;
proc report data = test2  nocenter nowd ;
by id;                                    *adding by group here;
define ID / order id ;
define variable1 / display;
define variable2 /display;

compute after ID;
  line '';
  endcomp;

run;
ods pdf close;

您的输出文件类型是什么?PDF、RTF、文本、PowerPoint、Excel?输出是PDF,如测试过程报告中所示。请使用BYVAL按组尝试使用标题。