2

I was writing a proc tabulate report, which would summarize data in a table by day and by week.

So far this is what I have:

PROC TABULATE
DATA=WORK.FB_REPORT
   ;
   VAR ORDERS UNITS PRICE SERVICE_CHARGE FRUIT_BOUQUET_REV REVENUE;
   CLASS SALES_TYPE /   ORDER=UNFORMATTED MISSING;
   CLASS ORDER_DATE /   ORDER=UNFORMATTED MISSING;
   TABLE 
          /* By Row*/
          ORDER_DATE *(  Sum={LABEL="Sum"}   )  
          all = 'Total'  *(  Sum={LABEL="Sum"}   )  , /*  CHANGE THIS LINE */
          /* By Column */
          SALES_TYPE *(ORDERS  UNITS  PRICE  SERVICE_CHARGE  MERHCREV  REVENUE REVENUE)
          all = 'Total'  *(MERCHREV  REVENUE REVENUE) ;
   ;

RUN;

How can I change the all = 'Total'*(Sum={LABEL="Sum"}) statement such that, to sum by grouping weeks in ORDER_DATE?

4

1 回答 1

1

您可以使用格式来完成此操作。有几种与周相关的格式,如果没有您喜欢的格式,您可以使用图片格式自行滚动。下面是一个使用一直流行的 WEEKU 格式的示例:

proc tabulate data=sashelp.citiday;
class date;
var SNYDJCM SNYSECM;
format date WEEKU11.;
tables all date,(snydjcm snysecm)*sum;
run;

Date 是一个变量,包含数据集整个期间的日期,每天一行。(浏览 sashelp.citiday 了解更多信息。)

于 2013-07-24T21:16:13.833 回答