欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

SAS BREAK RBREAK COMPUTER

最编程 2024-02-15 18:32:38
...

 

COMPUTE是在page前后或者group变量前后等计算一些内容。或者生成一个数据集中没有的新变量.例如:

define a / computed;

compute a;

endcomp;

 

ods rtf file = "./rbreak.rtf";
title;
footnote;

proc report data=SHOES spanrows;
 where region in ('Asia' 'Canada') and product in ('Boot' 'Sandal' 'Slipper');
 title 'D) Many of the Other Forms of COMPUTE';
 column region product sales returns Profit inventory PctInv ;
 define region / group;
 define product / group;
 define profit / computed f=dollar14.;
 define pctinv / computed f=percent9.2;

 compute before _page_;
 line '1) COMPUTE BEFORE _PAGE_';
 endcomp;
 compute before;
 line '2) COMPUTE BEFORE';
 endcomp; 
 compute before region;
 line '3) COMPUTE BEFORE region';
 endcomp;
 compute after region;
 line '4) COMPUTE AFTER region';
 endcomp;
 compute after;
 line '5) COMPUTE AFTER';
 endcomp;
 compute after _page_;
 line '6) COMPUTE AFTER _PAGE_';
 endcomp;
run;

ods _all_ close;

 

 

 

dul 这类选项只在LISING中有效

break Rbreak基本都是算一些统计量,或者插入空白页。

Rbreak是在page前或page后作这些事情

break是在某个group 变量前或后作这些事情

 

data SHOES;
    set SASHELP.SHOES;
run;

ods rtf file = "./rbreak.rtf";
title;
footnote;

proc report data=SHOES spanrows;
 where region in ('Asia' 'Canada') and product in ('Boot' 'Sandal' 'Slipper');
 title 'D) Many of the Other Forms of COMPUTE';
 column region product sales returns Profit inventory PctInv ;
 define region / group;
 define product / group;
 define profit / computed f=dollar14.;
 define pctinv / computed f=percent9.2;

 compute before _page_;
 line '1) COMPUTE BEFORE _PAGE_';
 endcomp;
 compute before;
 line '2) COMPUTE BEFORE';
 endcomp; 
 compute before region;
 line '3) COMPUTE BEFORE region';
 endcomp;
 compute after region;
 line '4) COMPUTE AFTER region';
 endcomp;
 compute after;
 line '5) COMPUTE AFTER';
 endcomp;
 compute after _page_;
 line '6) COMPUTE AFTER _PAGE_';
 endcomp;

 rbreak before/ summarize dul style = {color = red};
 rbreak after / summarize dul style = {color = red};

 break before region / summarize dul style = {color = green};
 break after region / summarize dul style = {color = green};

run;

ods _all_ close;