Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str1 PATIENTSEX str49(CHLAMTESTS HIVTESTS) "F" "Gonorrhoea, Chlamydia and Trichomonas NAAT" "Gonorrhoea, Chlamydia and Trichomonas NAAT" "F" "" "Gonorrhoea, Chlamydia and Trichomonas NAAT, urine" "F" "Gonorrhoea, Chlamydia and Trichomonas NAAT" "Hepatitis C, HIV detection" "F" "Gonorrhoea, Chlamydia and Trichomonas NAAT, urine" "" "F" "" "HIV antibodies 1/2" "M" "" "HIV antibodies 1/2, Hepatitis C, HIV detection" "F" "Gonorrhoea, Chlamydia and Trichomonas NAAT, urine" "Gonorrhoea, Chlamydia and Trichomonas NAAT, urine" "F" "Gonorrhoea, Chlamydia and Trichomonas NAAT" "Gonorrhoea, Chlamydia and Trichomonas NAAT, LVS" "F" "Gonorrhoea, Chlamydia and Trichomonas NAAT" "HIV antibodies 1/2, Hepatitis C, HIV detection" "F" "" "Gonorrhoea, Chlamydia and Trichomonas NAAT, urine" "F" "Gonorrhoea, Chlamydia and Trichomonas NAAT, urine" "" "F" "Gonorrhoea, Chlamydia and Trichomonas NAAT" "Gonorrhoea, Chlamydia and Trichomonas NAAT" end
Code:
egen all_tests=concat( chlamtests hivtests) gen ct_test = 0 replace ct_test = regexm( all_tests, "chlamydia") & regexm( all_tests, "Chlamydia") gen hiv_test = 0 replace hiv_test = regexm( all_tests, "HIV")
Thanks
0 Response to How can I 'find' a specific word across multiple variable strings?
Post a Comment