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
Can you please advise how one can output the contents of the PDV for each iteration as one steps through a SAS Program in order to validate the logic on a test case?
data _null_;
set sashelp.class;
where sex = "M";
put name= age= sex=;
run;
/* on log
Name=Alfred Age=14 Sex=M
Name=Henry Age=14 Sex=M
Name=James Age=12 Sex=M
Name=Jeffrey Age=13 Sex=M
Name=John Age=12 Sex=M
Name=Philip Age=16 Sex=M
Name=Robert Age=12 Sex=M
Name=Ronald Age=15 Sex=M
Name=Thomas Age=11 Sex=M
Name=William Age=15 Sex=M
*/
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.