根据sas宏,分组输出rtf

该文章展示了一段SAS代码,它定义了一个名为%grpprint的宏,用于处理输入数据集(indata=sashelp.class)。宏首先根据指定的变量(grpvar=age)提取不同的年龄值,然后对每个年龄组创建子数据集,并使用Procreport生成详细的报告,包括体重和身高等信息。报告以RTF文件形式保存,每页显示特定年龄组的数据。
摘要由CSDN通过智能技术生成

%macro grpprint(indata=,grpvar=);
/*grpvar would be assigned to the age1-*/
proc sql noprint;
   select distinct &grpvar into : age1 - from &indata;
quit;

/*total equal the number of macro varible*/
%let total = &sqlobs;

/*write do loop according to the macro variable age1: age&sqlobs*/

/*obtain the subset dataset*/
%do i=1 %to &total;
proc sql noprint;
  create table data&i as
  select *
  from &indata
  where age = &&age&i;
quit;

/*use proc report:dataset is the subset dataset:do loop*/
options papersize=letter ps=max ls=max nofmterr nonumber nodate formchar='|_---|+|---+=|-/\<>*' missing=' ';
ods escapechar="@";
ods rtf file="report&i..rtf" style=rtftable; *bodytitle;
title j=c "There are &sqlob

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值