Hi,

I'd be thankful for 'a cheat' in order to improve my code on interaction between the factor steps.
I hereby also want to make the proposal of adding a new function to GRETL called 'interaction'
that could be used like 'dummify'.  I'm thinking of something like interaction(series or list [discrete variables], optional series or list).
If only one argument is given this would be the case of the example below, if two arguments are given the case of the user guide is tackled.

Up until now I generated interaction series according to the example on p.121 in the guide.
Now with factor step combinations it's getting really tricky:
1) make the list of factors                                                 -> ok 
2) make dummies for all steps of each factor                -> ok
3) interact the dummies BUT without replications       -> here I have a problem

What if there are more than two factors? My 'if condition' is not that good.
I'm using the 'loop foreach' construction.

<hansl>
dummify factors
loop foreach i factors-q
    sprintf ni "%d",i
    list Dum_$i=null 
    string str="D$i*"
    list Dum_$i=@str
endloop

loop foreach i factors-q
    loop foreach j factors-q  
        count++
        if count<2 || count>nfactors
            break
        else
        sprintf ni "%d",i
        sprintf nj "%d",j

        smpl D$i_@ni>0 --restrict --replace
        smpl D$j_@ni>0 --restrict --replace
        smpl D$j_@nj>0 --restrict --replace
        smpl D$i_@nj>0 --restrict --replace
        endif
enloop
<hansl>

Cheers
Leon