Thanks for your suggestion, but it doesn't seem to work with my script. It doesn't seem possible to make Gretl recognize j=i+1 or $j =$i+1 as a new index...