Hi,
I am attempting to generate a binary variable "weap_firearm" from two string (strL) variables "objetivo" and "subjetivo" which are both variables that contain medical notes from consultations.
This is the code I am running:
The issue I'm having is that the excluded terms are still coming up. For example, the medical record in the variable "objetivo" containing notes (personal/sensitive information redacted): "REFERE QUE FEZ O TESTE DA FARMACIA PARA GRAVIDEZ" was not excluded despite "FARMACIA" being an excluded term in the search. I appreciate the text is in Portuguese, but hope that the inclusion/exclusion question is clear.
I have not provided a dataex file as this dataset contians identifiable data and I can't guarantee the medical records do not contain personal/sensitive information.
I am using Stata 18 for reference.
Happy to provide more information if necessary.
Appreciate any help, thank you in advance.
Kind regards
I am attempting to generate a binary variable "weap_firearm" from two string (strL) variables "objetivo" and "subjetivo" which are both variables that contain medical notes from consultations.
This is the code I am running:
Code:
gen weap_firearm = ustrregexm(subjetivo, "(TIRO.*|ARMA.*|PISTOL.*|ESFAQUEA.*|FACA.*|FERID.* BALA|BALEAD.*|FERID.* FACA)") | ///
ustrregexm(objetivo, "(TIRO.*|ARMA.*|PISTOL.*|ESFAQUEA.*|FACA.*|FERID.* BALA|BALEAD.*|FERID.* FACA)") & ///
!ustrregexm(subjetivo[-5/5], "(NAMORAD.*|PARCEIR.*|MARIDO|MULHER|ESPOS.*|FAM.*|CONJUGE|COMPANHEIR.*|CONSORTE|DOMESTIC.*|CASA|RESIDENCIA|FAMILIA.*|ESTUPR.*|CONJUGAL|NEGLIG.*|SUSPEIT.*|SEXUAL)") & ///
!ustrregexm(objetivo[-5/5], "(NAMORAD.*|PARCEIR.*|MARIDO|MULHER|ESPOS.*|FAM.*|CONJUGE|COMPANHEIR.*|CONSORTE|DOMESTIC.*|CASA|RESIDENCIA|FAMILIA.*|ESTUPR.*|CONJUGAL|NEGLIG.*|SUSPEIT.*|SEXUAL)") & ///
!ustrregexm(subjetivo, "(TIROIDE|LEVOTIROXINA|TIRO DUVIDAS|REFACA|FARMACIA|RETIROU|DIALEVOTIROXINA|FARMACOS|TUMEFACAO|FARMACEUTICO|FARMACOLOGICO|ALARMA|TIROU|RETIRO|AFERIDA)") & ///
!ustrregexm(objetivo, "(TIROIDE|LEVOTIROXINA|TIRO DUVIDAS|REFACA|FARMACIA|RETIROU|DIALEVOTIROXINA|FARMACOS|TUMEFACAO|FARMACEUTICO|FARMACOLOGICO|ALARMA|TIROU|RETIRO|AFERIDA)")
I have not provided a dataex file as this dataset contians identifiable data and I can't guarantee the medical records do not contain personal/sensitive information.
I am using Stata 18 for reference.
Happy to provide more information if necessary.
Appreciate any help, thank you in advance.
Kind regards

Comment