On Fri, 2 Nov 2012, Henrique Andrade wrote:

> Dear Huugh,
>
> Please take a look at the following Hansl code:
>
> <hansl>
> open australia.gdt
>
> loop i=1..3
>    string name = varname(i)
>    adf 4 @name
> endloop
> </hansl>
>
> I think it could help you solving your problem.

The solution that Henrique suggested is probably the best, but there are 
other that you may like more: for a start, you may be able to use the 
foreach variant to the loop command, as in

<hansl>
open greene13_1.gdt

loop foreach i GM CH GE WE US
     ols I_$i const F_$i C_$i
endloop
</hansl>

Next, you may do clever things with string substitution; a bit of a hack, 
but not untolerable:

<hansl>
open AWM.gdt

loop i=1..3
     scalar x1 = i + 10
     scalar x2 = i + 20
     sprintf cmd "ols %d const %d %d", i, x1, x2
     @cmd
end loop
</hansl>

--------------------------------------------------
  Riccardo (Jack) Lucchetti
  Dipartimento di Economia

  Università Politecnica delle Marche
  (formerly known as Università di Ancona)

  r.lucchetti(a)univpm.it
  http://www2.econ.univpm.it/servizi/hpp/lucchetti
--------------------------------------------------

Reply via email to