03-13-2015 02:28 PM
I am a novice with SAS and am trying to create a simple column total. I have read past discussions in SAS but still have not gotten what I need. I have tried to use both Proc SQL and Proc Print to accomplish this task. Any help is appreciated.
I have the following data:
I tried the following codes:
create table charges2 as
sum(t1.charge_amt) as totalcharges
from work.charges as t1
group by id;
keep id charge_amt;
proc print data=charges noobs;
03-13-2015 04:05 PM
Yes indeed, that's the functionality of sum statement, which retains across observation and assigns automatically an initial value of 0 for the first obs.
Definition: Adds the result of an expression to an accumulating variable.
Need further help from the community? Please ask a new question.