Hi Good Eveyone
How to find cumulative sum for height in class library
using proc sql
data dsn;
set sashelp.class;
run;
proc sort data=dsn;
by age;
run;
data dsn1;
set dsn;
by age;
retain cumulative 0.;
if first.height then height+cumulative;
else cumulative+height;
run;
If you simply want a cumulative sum of heights and do not want to consider by-groups, then no by-statement is needed in the data step. Simply do
proc sort data=sashelp.class out=dsn;
by age;
run;
data want;
set dsn;
cumulative+height;
run;
i want using proc sql sort by age variable and output cumulative sum of height
Why? So much easier with the data step
Hi draycut
its just do for homework
Dead simple:
Build the SQL code by following the hints, and let us see what you come up with.
As already stated in another thread, I will not insult your intelligence by spoon-feeding you this very simple exercise.
PS a home exercise is for you to solve. If you can't, there's three possibilities:
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.