hi, I have a problem for which I am sure STATA has an
easy solution but I couldn’t to find it. I hope you can help
me.
Here is what I need to do:
I have a string variable called disease_ICD (oldvar) which has the values of "International Statistical Classification of Diseases and Related Health Problems – ICD 9 and ICD 10"
I need to create a new variable disease_ICDgroup (newvar) containing grouped values of disease_ICD (oldvar). The equivalent in EPI INFO is:
. Define newvar TEXTINPUT
. IF(substring(oldvar,1,3)>="001"AND substring(oldvar,1,3)<"799"THEN ASSIGN newvar ="1" END
. IF(substring(oldvar,1,3)>="A00"AND substring(oldvar,1,3)<"U99"THEN ASSIGN newvar ="1" END
. IF(substring(oldvar,1,3)>="800"AND substring(oldvar,1,3)<"999"THEN ASSIGN newvar ="2" END
. IF(substring(oldvar,1,3)>="V00"AND substring(oldvar,1,3)<"Y99"THEN ASSIGN newvar ="2" END
Note: The first three characters from oldvar are the same in all banks (more than 20 banks) which allowed me to create ranges and commands that can be used in all banks.
How do I do this in STATA?
_________________________________________________________________
Use video conversation to talk face-to-face with Windows Live Messenger.
http://www.windowslive.com/messenger/connect_your_way.html?ocid=TXT_TAGLM_WL_Refresh_messenger_video_072008
*
* 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/