SAS中的report过程简介

来源:互联网 发布:黄金白银行情软件 编辑:程序博客网 时间:2024/06/05 19:32

SAS系统中的report过程是制作报表的工具,可以将print、means和tabulate过程的特点与DATA步报告写法的特点结合起来组合成一个强大的生成报表的工具。

    语法格式:proc report <报表选项>;                                            常用报表设置语句;            run;

例子:房价经济指数数据,环比与同比、定基数据生成报表。

data house;input city $ hb_index same_index def_index;//导入数据并指定输入数据格式cards;北京 99.9 100.3 102.4天津 99.8 100.2 103.1秦皇岛 99.8 100.5 106.3石家庄 99.7 101.3 107.7包头 99.8 100.0 103.9太原 100.0 100.9 101.7;run;proc print data=house;//打印数据表run;proc report data=house headline headskip;  //report过程 //headline:指定报表标题信息//headskip:指定报表副标题title '六个大中城市住宅销售价格指数(2012年2月)';title2 '单月城市销售价格';column city hb_index same_index def_index dif;  //column:制定报表列显示顺序define city/order format=$6. width=6 '城市';     //定义变量并对变量指定类型define hb_index/display format=5.1 width=5 '环比';define same_index/display format=5.1 width=5 '同比';define def_index/display format=5.1 width=5 '定基';define dif/computed format=5.1 width=5 '差比';    //定义计算变量compute dif;                                    //执行计算,或生成中断行dif  = same_index-hb_index;endcomp;                                        //结束语句run;

结果:

这里写图片描述

原创粉丝点击