ODS HTML 输出之前的 Proc 报告中的 SAS 标题抑制

问题描述 投票:0回答:1

我面临的一个简单但顽固的标题问题:我有很多 proc 报告语句(下面仅显示 2 个),前面是总体文档标题和描述文本。在我的代码中的 10 个左右 proc 报告语句中,只有代码中间的 2 个报告(第 5 个和第 6 个 proc 报告语句)正在输出,因为其他报告当前没有数据(这很好)。但是,这可能会影响整体标题和 ods 文本,因为它们会被抑制,或者反过来会抑制我的 ODS HTML 输出中的过程报告标题。 目前,下面的代码允许整体标题和 ods 文本出现在输出中,但两个 proc 报告中的第一个 (salesit) 现在在输出中缺少其标题。 在 Proc 报告之前为 ODS HTML 输出编写整体标题和描述文本的正确方法是什么,以确保标题不会相互影响和相互抑制?事实上,10 个进程报告中的 8 个不会输出数据,因为没有缺少 ID 导致标题问题吗?

ods listing close;
ods html body = 'filepath\missingsurveys.html';

title 'Missing Surveys Over Time';
ods text = 'The tables below display missing surveys by customer id';

proc report data = salesit;
column n customer_id sale_date;
compute n;
_n+1;
n=_n;
endcomp;
title 'Customer_Ids from IT Sales';
endcomp;
run;

proc report data = salespmo;
column n customer_id sale_date;
compute n;
_n+1;
n=_n;
endcomp;
title 'Customer_Ids from Management Support Sales';
endcomp;
run;

ods html close;
ods listing; 

html sas ods proc-report
1个回答
0
投票

我不太理解你的问题,但作为最佳实践,由于 TITLE 语句是全局语句,因此将其放在 PROC STEP 之外会更清楚。另外,在标题不再适用后清除标题也是个好主意。例如:

ods listing close;
ods html body = 'filepath\missingsurveys.html';

title 'Missing Surveys Over Time'; *I am confused by this title, what is it for? ;
ods text = 'The tables below display missing surveys by customer id';

title1 'Customer_Ids from IT Sales';
proc report data = salesit;
  column n customer_id sale_date;
  compute n;
    _n+1;
    n=_n;
  endcomp;
run;
title1; *clear title;

title1 'Customer_Ids from Management Support Sales';    
proc report data = salespmo;
  column n customer_id sale_date;
  compute n;
    _n+1;
    n=_n;
  endcomp;
run;
title1; *clear title;

ods html close;
ods listing; 

每次您发出

TITLE
声明时,它都会清除所有现有标题。如果您想要保留主标题并添加副标题,您可以使用
TITLE1
作为主标题,使用
TITLE2
作为副标题。当
TITLE2
执行时,它将清除TITLE2-TITLE10,但不会清除TITLE1。

© www.soinside.com 2019 - 2024. All rights reserved.