If I'm understanding what you want: sum some value across all rows in you table.
then I think this will work.
data example;
set example;
if _n_ = 1 then sum=0; *I do not think you need this line but I put in for example;
sum + height; increments sum by value of height;
run;
I'm not sure of what you are thinking about when you say use sum function over height column. The sum function works on columns in a single row ie
something like this.... sum = sum(ht1, ht2, ht3).
This syntax sums across rows. So when i = linescount, Height will be the sum of height over all lines.
You certainly can get more creative with what you increment - as you say some more complex calculation
for example : sum + (a + b*(c^2)*d/e); where a-e are all columns.
Hope this helps
April 27 – 30 | Gaylord Texan | Grapevine, Texas
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!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.