<p></p><p>难道在宏里面不能写多个data步吗?j变量哪里错了?</p><p>%macro yi; /*calculate average per group*/<br/>%do i=1 %to 228;<br/>&nbsp;data;<br/>&nbsp;&nbsp; do j=0 to 17;<br/>&nbsp;&nbsp; y&amp;j.=0;<br/>&nbsp;&nbsp; t&amp;j.=0;<br/>&nbsp;&nbsp; av&amp;j.=0;<br/>&nbsp;&nbsp; end;<br/>run;<br/>data sti.sort&amp;i.;<br/>set sti.yield5;<br/>set sti.y10sort&amp;i.;</p><p>&nbsp; %do k=0 %to 17;<br/>&nbsp; if p=&amp;k. then do<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; y&amp;k.=y&amp;k.+c&amp;i.;<br/>&nbsp;&nbsp;&nbsp; t&amp;k.=t&amp;k.+1;<br/>&nbsp;&nbsp;&nbsp; end;<br/>&nbsp; %end;<br/>run;<br/>data sti.sort&amp;i.;<br/>&nbsp; %do r=0 %to 17;<br/>&nbsp;av&amp;r.=y&amp;r./t&amp;r.;<br/>&nbsp;%end;<br/>keep code p y&amp;i. c&amp;i. t0-t17 av0-av17;<br/>run;<br/>%End;<br/>%MEND yi;<br/>%yi;</p>
[此贴子已经被作者于2007-12-25 17:51:49编辑过]