Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: make use of values of some variables to identify another variable


From   "Maria Dolores Montoya Diaz" <[email protected]>
To   <[email protected]>
Subject   st: make use of values of some variables to identify another variable
Date   Sun, 6 Apr 2008 20:19:35 -0300

Hello:

I�m trying  to make use of the combination of the values of four variables
(var1-var4) to identify another variable among a big list, which content
will be part of another operation. The situation is:

                 var1   var2  var3      var4 ...   cod_0001     cod_0002
.....  cod_1032
obs 1         1          0        3          2    ...    0.2435
0.5572       .....    0.3453
obs 2         0          0        0          1    ...    0.0632
0.1023       .....    0.5532
   :            

So, for obs 1, the variable selected will be cod_1032, for obs 2, cod_0001,
and so on. I need to do something like this: 

gen variable_new = cod_`var1'`var2'`var3'`var4' *  sqrt(var5)

I would be thankful for any hints how to do that. Thank you very much in
advance

Dolores Diaz.





<<attachment: winmail.dat>>




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index