为什么在proc报告中使用RowNum + 1

时间:2017-02-09 08:13:18

标签: sas rownum proc-report

我发现如果要在标题后的第1天为列着色,我必须添加' RowNum + 1;'。没有它,如果我更改数字,我的代码将无法正常工作。有人可以告诉我为什么吗?非常感谢你!

proc report data=final_report15 nowindows split='*'
style(header)={foreground=white};
column category Work_types2 tot_act day0 day1 day2 day3 day4 day5_9 day_11  ph tot_pend day0_p day1_p day2_p day3_p day4_p;
define category/'#' style(header)=[background=grey];
define Work_types2/'Work types' style(header)=[background=grey];
define tot_act/'# in active*queue' style(header)=[background=Deepskyblue];
define day0/'Day 0' style(header)=[background=Deepskyblue];
define day1/'Day 1' style(header)=[background=Deepskyblue];
define day2/'Day 2' style(header)=[background=Deepskyblue];
define day3/'Day 3' style(header)=[background=Deepskyblue];
define day4/'Day 4' style(header)=[background=Deepskyblue];
define day5_9/'Day 5-10' style(header)=[background=Deepskyblue];
define day_11/'Day 11+' style(header)=[background=Deepskyblue];
define ph/' ' style(header)=[background=Black];
define tot_pend/'Pending Total' style(header)=[background=orange];
define day0_p/'Day 0' style(header)=[background=orange];
define day1_p/'Day 1' style(header)=[background=orange];
define day2_p/'Day 2' style(header)=[background=orange];
define day3_p/'Day 3' style(header)=[background=orange];
define day4_p/'Day 4' style(header)=[background=orange];
title "Pend Queue Report - Wipro";
compute day1;
RowNum+1;
if ((RowNum>=2 and RowNum<=7) or (RowNum>=9 and RowNum<=10) or (RowNum>=12 and RowNum<=13) or (RowNum>=15 and RowNum<=18) or (RowNum>=20 and RowNum<=31)) then do;
call define(_col_,'style','style=[background=yellowgreen]');
end;
endcomp;
if ((RowNum>=2 and RowNum<=7) or (RowNum>=9 and RowNum<=10) or (RowNum=12) or (RowNum>=15 and RowNum<=18) or (RowNum>=20 and RowNum<=25) or (RowNum>=27 and RowNum<=31)) then do;
call define(_col_,'style','style=[background=yellowgreen]');
end;
if (RowNum=13 or RowNum=26) then do;
call define(_col_,'style','style=[background=gold]');
end;
endcomp;
run;

1 个答案:

答案 0 :(得分:2)

您没有向我们展示足够的代码以确定,但RowNum不是关键字,它是变量的名称(可能是输入数据中存在的变量,或者您可能正在创建变量在计算块中。)

我希望在你的代码中,RowNum+1;创建RowNum变量(并在每次执行语句时递增它)。