Statalist


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

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


From   "Maria Dolores Montoya Diaz" <madmdiaz@usp.br>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RES: RE: make use of values of some variables to identify another variable
Date   Tue, 8 Apr 2008 12:46:47 -0300

Dear Nick, thank you very much!!! Itīs not the most efficient solution but
it functions very well. Besides, Iīve introduced an if condition to
eliminate problems with missing values. So the final version: 

gen variable_new = . 
qui forval i = 1/`=_N' { 
	local var1 = var1[`i'] 
	local var2 = var2[`i'] 
	local var3 = var3[`i'] 
	local var4 = var4[`i'] 
	if mi(var1[`i'], var2[`i'] ,var3[`i'] , var4[`i'] )==0 {
replace variable_new = cod_`var1'`var2'`var3'`var4'* sqrt(var5) in `i'
}
}

Dolores.




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