SAS中文论坛
标题:
looking help for an effective summation approach
[打印本页]
作者:
shiyiming
时间:
2012-1-2 13:40
标题:
looking help for an effective summation approach
%let x1=2;
%let x2=9;
%let x3=0;
...
%let x50=11;
Suppose Xs above were generated into series of macro variables x1 - x50.
my question, what is the effective way to sum them up?
I tried:
%let sum_x=%sysfunc(&x1.,&x2.,...,&x50.);
but it looks pretty much stupid.
so just wonder anyone can help?
thanks lot and happy new year!
作者:
shiyiming
时间:
2012-5-17 21:39
标题:
Re: looking help for an effective summation approach
%let x1=2;
%let x2=4;
%let x3=6;
%let x4=5;
%let s=0;
%macro summation;
%do i=1 %to 4;
%let s=%eval(&s+&&x&i);
%end;
%put &s;
%mend;
%summation;
欢迎光临 SAS中文论坛 (http://www.mysas.net/forum/)
Powered by Discuz! X3.2