Paccio
05-28-2012, 07:33 AM
Hello!
I need help with the creation of some dummy variables and I hope some of you can lend me a hand.
I need 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 don't need to create each dummy individually, since that would take a lot of time (I actually have much more than just three variables).
What I need is some sort of loop which would automatically create a dummy for each possible combination of positive and negative variable a, b and c.
I don't have any idea if this is something possible with VBA, but if it is I would really really appreciate your help in writing this code.
Thank you very much in advance.
Cheers,
Paolo
I need help with the creation of some dummy variables and I hope some of you can lend me a hand.
I need 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 don't need to create each dummy individually, since that would take a lot of time (I actually have much more than just three variables).
What I need is some sort of loop which would automatically create a dummy for each possible combination of positive and negative variable a, b and c.
I don't have any idea if this is something possible with VBA, but if it is I would really really appreciate your help in writing this code.
Thank you very much in advance.
Cheers,
Paolo