Hi Leon,

thanks but this way I would need to manually specify every dummy, which would still require a lot of time since I have a lot of variables (I'm using three here just to make a quick example).

What I'm looking for (if this possibility exists) is some sort of loop which would create a dummy for each possible combination of positive and negative variable a, b and c.

Thanks again for your help.


Paolo

2012/5/28 Pindar <pindar777@googlemail.com>
Hi Paolo,

this kind of operation can be easily done with gretl using hansl (with means via scrioft or console)

In order to get a dummy variable with value 1 if a,b, and c are positive numbers and otherwise zero use this code:

series d_all_p = (a>=0 && b>0 && c>0)? 1 : 0

Cheers
Leon



Am 28.05.2012 15:15, schrieb Paolo Caliņ:
Hello!

I need to create some dummy variables in order to capture all the possible combinations of a certain set of variables.

For instance, let's assume I have three variables a, b, c.

I need one dummy equal to 1 when all three variables are positive, zero otherwise.
I need one dummy equal to 1 when all three variables are negative, zero otherwise.
I need one dummy equal to 1 when a and b are positive and c negative, zero otherwise.
I need one dummy equal to 1 when a and c are positive and b negative, zero otherwise.
Etc etc etc...

I would do this in Excel since my database is taken from a csv, but the actual number of variables is much higher then 3, so it takes a lot of time to do it manually.

I don't have any idea if it is possible to create these dummies automatically with some piece of code in GretL, but if it is I would really really appreciate your help in writing this code.

Thank you very much in advance.

Cheers,


Paolo


_______________________________________________
Gretl-users mailing list
Gretl-users@lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users


_______________________________________________
Gretl-users mailing list
Gretl-users@lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users