I'm thinking that I need some way to pass the lagged value into the sum function. All my tests seem to indicate just saying sum(lag(x1)) does not pass a value
It would be easier you would provide us your code.
But may be the following gives you the hint you need.
data have;
do x1=1 to 5;
x2=10*x1;
output;
end;
run;
data want;
set have;
retain x2sum;
x2sum=sum(x2sum,x2);
sumvar=sum(x1*lag(x1), x2*x2sum);
put x1= x2= x2sum= sumvar=;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Registration is open
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss. Register now and lock in 2025 pricing—just $495!