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" <[email protected]>
To   <[email protected]>
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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index