Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: Comparing variable values with a predefined list in other dataset‏


From   Andres Gonzalez Rangel <[email protected]>
To   <[email protected]>
Subject   RE: st: Comparing variable values with a predefined list in other dataset‏
Date   Sat, 3 Oct 2009 01:12:14 +0000

Thanks for your response.
 
I think merge is not a solution for my problem, because I need to keep both bases separated.  Datasets with diagnostic or procedure codes are for reference, while the working dataset contains the values which need to be compared.  Is more like a validation process, checking if a variable's value corresponds to any value in the other dataset.
 
For an example, with only 3 values to check:
 
. generate _valid = 0
. replace _valid = 1 if variable == "A91.X" | variable == "N39.0" | variable == "I50.0"
 
But with 16000 values to compare I hope there must be an easier way.  I don't know mata, but the sequence might look like
 
. generate _valid = 0
. command to begin a subroutine
. command to "call" reference_dataset.dta
. do for every observation of diagnostic_codes.dta
. replace _valid = 1 if variable == _referencevar
. loop
 
The closest ado for this is icd9, but I need to verify ICD10 codes and other local (but equally numerous) codes.
 
Thanks again for your consideration.
 
Regards,
 
Andrés González Rangel 		 	   		  
_________________________________________________________________
Your E-mail and More On-the-Go. Get Windows Live Hotmail Free.
http://clk.atdmt.com/GBL/go/171222985/direct/01/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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