I want to create new variables based on a set of different variables.
Example:
ID | var1 | var2 | var3 | var4 | newvar1 | newvar2 |
1 | 0,0089 | 0,0086372 | 0,0057962 | 0,0053456 | 0,0089/0,0057962 | 0,0086372/0,0053456 |
2 | 0,0098 | 0,00365 | 0,0058 | 0,0053 | 0,0098/0,00689 | 0,00365/0,0053 |
I don't know how to finish this part:
foreach var of varlist var1-var2 {
egen newvar`var'= `var'/??????
}
Thanks in advance!
0 Response to Dividing observations in a loop
Post a Comment