Hi,

For a quick reply, you may try to format the numbers with
sprintf(name,"dt_%0d",Z)

and the  genr k=($i*12) is better to  genr k=(i*12), because you do
not need the string.

I am sure there will more complete answers :)

Helio

On Mon, May 14, 2012 at 7:25 PM, Kevin Vermeiren
<vermeiren89(a)hotmail.com> wrote:
> Dear all,
>
> I am working with panel data and I want to run a loop with time dummies.
> Unfortunately, I encounter a problem when trying to do so.
>
> loop i=1..4 # this loop needs to be performed 4 times
>     genr k=($i*12)
>     genr Z=k-11
>     matrix Big=zeros(25,14)
>     list R= dt_$Z..dt_$k
>     scalar j=0
>     loop foreach x R
>         smpl $x --dummy
>
> Here is the first part of my script where things go wrong. I need to make
> the list R 4 times. First with dt_1 to dt_12, in the second loop from dt_13
> to dt_24 and so.
> After running this script Gretl returns the error value:
>
> ? list R= dt_$Z..dt_$k
> The symbol 'dt_' is undefined
>>> list R= dt_$Z..dt_$k
>
> When I run the following script I get the right values for k and Z but they
> have 6decimal digits (0's) (for instance Z=1,000000 instead of 1):
> loop i=1..4 # this loop needs to be performed 4 times
> genr k=($i*12)
> genr Z=k-11
> print k Z
> endloop
>
> Therefore I assume that the problem is that Gretl does not recognize
> dt_1,000000. I tried to use the function int() and round() to get rid off
> those decimal digits but these functions did not help.
>
> Is there any other solution to get rid off the decimal digits so that Gretl
> gets as input dt_$Z = dt_1 instead of dt_1,000000?
>
> Many thanks in advance.
>
> Best regards,
>
> Kevin Vermeiren
>
> _______________________________________________
> Gretl-users mailing list
> Gretl-users(a)lists.wfu.edu
> http://lists.wfu.edu/mailman/listinfo/gretl-users

Reply via email to