我编写了以下查询以从 SAS 表中提取不同军事状态的列表。
proc sql;
create table mil_stat as
select distinct MILITARY_STAT_sERSS format $MILSTAT. as MILITARY_STATUS,
count(*) as TOTAL
from FPE
group by MILITARY_STAT_sERSS;
quit;
我需要添加一个显示总计数的摘要行。我试图在 proc sql 语句中执行此操作,但无法弄清楚如何执行此操作。因此,我编写了以下 proc 报告语句以在报告中提供所需的行。
PROC REPORT DATA=work.mil_stat;
column MILITARY_STATUS TOTAL;
where MILITARY_STATUS ne '5';
define MILITARY_STATUS / group;
rbreak after / summarize style=[font_weight=bold];
compute MILITARY_STATUS;
if MILITARY_STATUS ne . then c_MILITARY_STATUS=MILITARY_STATUS;
else c_MILITARY_STATUS=' ';
if _break_ = '_RBREAK_' then MILITARY_STATUS = "Grand Total";
endcomp;
run;
任何能够显示“总计”字符串的帮助将不胜感激。