Reputation: 21
I have a problem in SAS where I have to sum n columns(Time(1) to time(N)) where the N is defined as a variable in another column(Min_Remain_wthdrw_Prd). I am writing the below code but it is not working:
data certain;set certain;
array t(*) t1-t60;
do while(i<=Min_Remain_wthdrw_Prd);
S_Disc=sum(t(1)-t(i));
end;
end;
run;
Kindly help
Upvotes: 0
Views: 382
Reputation: 7769
You have too many end
statements, and you can just use a regular do
loop...
data certain ; set certain ; array t(*) t1-t60 ; S_Disc = 0 ; do i = 1 to Min_Remain_wthdrw_Prd ; S_Disc+t{i} ; end ; run;
Upvotes: 3