Code:
proc report data=deposits nowd;
column cust_id
amount_deposited amount_deposited=deposit_count
amount_withdrawn amount_withdrawn=withdraw_count
avg_dep_amt avg_tran_count avg_wdraw_count;
define cust_id/ group;
define amount_deposited / analysis sum noprint;
define amount_withdrawn / analysis sum noprint;
define deposit_count/ analysis n noprint;
define withdraw_count/ analysis n noprint;
define avg_dep_amt / computed 'avg. deposit amount';
define avg_tran_count / computed 'avg. no. of transactions';
define avg_wdraw_count / computed 'avg. no. of withdrawals';
compute avg_dep_amt;
avg_dep_amt = amount_deposited/deposit_count;
endcomp;
compute avg_tran_count;
avg_tran_count = (deposit_count + withdraw_count)/3; /* there is a reason to divide by 3 */
endcomp;
compute avg_wdraw_count;
avg_wdraw_count = withdraw_count/3; /* there is a reason to divide by 3 */
endcomp;
run;
Log:
NOTE: Variable amount_deposited is uninitialized.
NOTE: Missing values were generated as a result of performing an operation on missing values.
Each place is given by: (Number of times) at (Line):(Column).
5 at 1:32
I can compute count the number of non-missing values of variable amount_deposited using alias, but I cannot compute sum of those values, log shows me that the variable is not initialized. What is the problem in SAS?