Dear all,
Suppose I have the following dataset.
I'd like to create new variables by dividing each variable (var1, var2, and var3) by a corresponding value of the variable var4.
More specifically, I'd like to create var5 by dividing var1 by the first observation of var4 (in this case, 12), var6 by dividing var2 by the second observation of var4 (24) and var7 by dividing var3 by the third observation of var4 (54).
Could anyone please help me with this ?
Thank you very much for your help,
Vinh
Suppose I have the following dataset.
Code:
input var1 var2 var3 var4 12 2 3 12 4 5 6 24 23 65 9 54 21 7 12 512 2 8 16 12 6 10 10 12 end
More specifically, I'd like to create var5 by dividing var1 by the first observation of var4 (in this case, 12), var6 by dividing var2 by the second observation of var4 (24) and var7 by dividing var3 by the third observation of var4 (54).
Could anyone please help me with this ?
Thank you very much for your help,
Vinh
Comment