Page 1 of 1

Automatically copy $(i) values to $(i+1)

Posted: December 4th, 2012, 7:45 am
by htuser
Other, assuming that i've a roster with two columns (CODE1 and CODAGE) and ten row i would like that the fisrt value entry by the operator in (CODE1(1))to be automatically copied in (CODE1(2)) or (CODE1(i+1) in the preproc.
it's because i write this code:
PROC GLOBAL
numeric i;
PROC CHAMP_FF
PROC CODE1
Preproc
i=1;
if i=1 then next // This instruction do not concern the first value entered by operators
else // if i>1
$(i) = $(i-1);// Copy the values of the first i, j to the second i, j so that $(2)=$(2-1), finally $(2)=$(1)
endif;
but, until now, no effect ...

Can anyone can help me please?
Thanks in advance,

Re: Automatically copy $(i) values to $(i+1)

Posted: December 4th, 2012, 8:58 am
by Gregory Martin
If you look at your logic, you'll see that the variable i will always be 1. For every occurrence, CODE1(1), CODE1(2), ..., i will be 1, so you'll always execute the next statement. Set i = curocc(); and your code should work.

Re: Automatically copy $(i) values to $(i+1)

Posted: December 4th, 2012, 9:14 am
by htuser
Thanks.
That's work fine.