Hello all,
I am trying to figure out how I would be able to select observations from a data set so that I may do some calculations. Might be easier if I show you the coding, so here it goes:
Data compare;
do i=1 to 10;
xt=0.7*rannor(0);;
if xt GE 0 then xt=1;
else xt=0;
output;
end;
run;
proc print data=compare;
ID i;
run;
So I end up with a data set of xt with 10 observations.
What I would like to do is find the cumulative sum of the xt observations (is it xsum + xt?), the sum of the first and last observation in the set xt (not manually, my actual data set has 1000+ points), and the sum of the pairs x0*x1, x1*x2 (otherwise noted as x(i)*x(i-1) in math terms). After that I'd like to use a formula with all those sums.
I've tried making an array, but I end up with a nxn table rather than a nx1 style table. I'm rather new at this so I am not sure if there is a way to do this.
Any ideas?
Thanks in advance.