Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clear
- use "C:\Users\GlaDOS\OneDrive\SDU\Neuro research\AndreasAneurysm\dataCleanup\useDO"
- //Sorterer hvor mange aneurysmer pt har
- gen numberOfAn = .
- replace numberOfAn = 1 if !missing(placement_of_the_au_1)
- replace numberOfAn = 2 if !missing(placement_of_the_au_1, placement_of_the_au_2)
- replace numberOfAn = 3 if !missing(placement_of_the_au_1, placement_of_the_au_2, placement_of_the_au_3)
- replace numberOfAn = 4 if !missing(placement_of_the_au_1, placement_of_the_au_2, placement_of_the_au_3, placement_of_the_au_4)
- replace numberOfAn = 5 if !missing(placement_of_the_au_1, placement_of_the_au_2, placement_of_the_au_3, placement_of_the_au_4, placement_of_the_au_5)
- egen sizeAn1 = rowmax(sz_anu_in_ica sz_anu_in_mca sz_anu_in_aca sz_anu_in_acom sz_anu_in_pcom sz_anu_a_basilaris sz_anu_in_pica sz_anu_with_other_local)
- egen sizeAn2 = rowmax(sz_anu_in_ica_2 sz_anu_in_mca_2 sz_anu_in_aca_2 sz_anu_in_acom_2 sz_anu_in_pcom_2 sz_anu_a_basilaris_2 sz_anu_in_pica_2 sz_anu_with_other_local_2)
- egen sizeAn3 = rowmax(sz_anu_in_ica_3 sz_anu_in_mca_3 sz_anu_in_aca_3 sz_anu_in_acom_3 sz_anu_in_pcom_3 sz_anu_a_basilaris_3 sz_anu_in_pica_3 sz_anu_with_other_local_3)
- egen sizeAn4 = rowmax(sz_anu_in_ica_4 sz_anu_in_mca_4 sz_anu_in_aca_4 sz_anu_in_acom_4 sz_anu_in_pcom_4 sz_anu_a_basilaris_4 sz_anu_in_pica_4 sz_anu_with_other_local_4)
- egen sizeAn5 = rowmax(sz_anu_in_ica_5 sz_anu_in_mca_5 sz_anu_in_aca_5 sz_anu_in_acom_5 sz_anu_in_pcom_5 sz_anu_a_basilaris_5 sz_anu_in_pica_5 sz_anu_with_other_local_5)
- gen aneurysmNumber = 1 if !missing(placement_of_the_au_1)
- replace aneurysmNumber = 2 if !missing(placement_of_the_au_2)
- replace aneurysmNumber = 3 if !missing(placement_of_the_au_3)
- replace aneurysmNumber = 4 if !missing(placement_of_the_au_4)
- replace aneurysmNumber = 5 if !missing(placement_of_the_au_5)
- //Laver en obs for hver pt per aneurysme
- expand 2 if aneurysmNumber == 2
- expand 3 if aneurysmNumber == 3
- expand 4 if aneurysmNumber == 4
- expand 5 if aneurysmNumber == 5
- //Laver en identifier til aneurysmer
- gen anIdentify = 1 if !missing(placement_of_the_au_1)
- replace anIdentify = 2 if !missing(placement_of_the_au_2)
- replace anIdentify = 3 if !missing(placement_of_the_au_3)
- replace anIdentify = 4 if !missing(placement_of_the_au_4)
- replace anIdentify = 5 if !missing(placement_of_the_au_5)
- //Sorterer data aneurysmer til specifikt ID
- bysort record_id: gen aneurysm_id = _n
- //Sorterer location efter aneurysmer
- gen location = .
- replace location = placement_of_the_au_1 if aneurysm_id == 1
- replace location = placement_of_the_au_2 if aneurysm_id == 2
- replace location = placement_of_the_au_3 if aneurysm_id == 3
- replace location = placement_of_the_au_4 if aneurysm_id == 4
- replace location = placement_of_the_au_5 if aneurysm_id == 5
- //Sorterer size efter aneurysmer
- gen anSize = .
- replace anSize = sizeAn1 if aneurysm_id == 1
- replace anSize = sizeAn2 if aneurysm_id == 2
- replace anSize = sizeAn3 if aneurysm_id == 3
- replace anSize = sizeAn4 if aneurysm_id == 4
- replace anSize = sizeAn5 if aneurysm_id == 5
- //Sorterer treatment efter aneurysmer
- gen treatmentChoice = .
- replace treatmentChoice = choice_of_treatment if aneurysm_id == 1
- replace treatmentChoice = choice_of_treatment_2 if aneurysm_id == 2
- replace treatmentChoice = choice_of_treatment_3 if aneurysm_id == 3
- replace treatmentChoice = choice_of_treatment_4 if aneurysm_id == 4
- replace treatmentChoice = choice_of_treatment_5 if aneurysm_id == 5
- //Sorterer kirurgiske komp til aneurysmer
- gen compSurgery = .
- replace compSurgery = surgical_comps if aneurysm_id == 1
- replace compSurgery = surgical_comps_2 if aneurysm_id == 2
- replace compSurgery = surgical_comps_3 if aneurysm_id == 3
- replace compSurgery = surgical_comps_4 if aneurysm_id == 4
- replace compSurgery = surgical_comps_5 if aneurysm_id == 5
- //Sorterer stent komp til aneurysmer
- gen compStent = .
- replace compStent = comp_stenting if aneurysm_id == 1
- replace compStent = comp_stenting_2 if aneurysm_id == 2
- replace compStent = comp_stenting_3 if aneurysm_id == 3
- replace compStent = comp_stenting_4 if aneurysm_id == 4
- replace compStent = comp_stenting_5 if aneurysm_id == 5
- //Sorterer coil komp til aneurysmer
- gen compCoil = .
- replace compCoil = comp_coil if aneurysm_id == 1
- replace compCoil = comp_coil_2 if aneurysm_id == 2
- replace compCoil = comp_coil_3 if aneurysm_id == 3
- replace compCoil = comp_coil_4 if aneurysm_id == 4
- replace compCoil = comp_coil_5 if aneurysm_id == 5
- //Sorterer coil eller stent komp til aneurysmer
- gen compCoilStent = .
- replace compCoilStent = comp_co_st if aneurysm_id == 1
- replace compCoilStent = comp_co_st_2 if aneurysm_id == 2
- replace compCoilStent = comp_co_st_3 if aneurysm_id == 3
- replace compCoilStent = comp_co_st_4 if aneurysm_id == 4
- replace compCoilStent = comp_co_st_5 if aneurysm_id == 5
- //Sorterer en komplikation lige meget hvilken
- gen compAtAll = .
- replace compAtAll = 0 if compSurgery == 0 | compStent == 0 | compCoil == 0 | compCoilStent == 0
- replace compAtAll = 1 if compSurgery == 1 | compStent == 1 | compCoil == 1 | compCoilStent == 1
- //Fjerner (4) values som ikke var hele integers
- replace treatmentChoice = . if !mod(treatmentChoice, 1) == 0
- //////////////////STENT//////////////////////
- //gen komp variabel
- gen stentAndet = .
- //0 hvis post er 0
- foreach v of var comp_post_stent*___8 {
- replace stentAndet = 0 if `v' == 0
- }
- //override til 1 hvis post er 1
- foreach v of var comp_post_stent*___8 {
- replace stentAndet = 1 if `v' == 1
- }
- //2 pt for andet
- gen stentInfekt = .
- foreach v of var comp_post_stent*___1 {
- replace stentInfekt = 0 if `v' == 0
- }
- foreach v of var comp_post_stent*___1 {
- replace stentInfekt = 1 if `v' == 1
- }
- gen stentHematom = .
- foreach v of var comp_post_stent*___2 {
- replace stentHematom = 0 if `v' == 0
- }
- foreach v of var comp_post_stent*___2 {
- replace stentHematom = 1 if `v' == 1
- }
- gen stentSepsis = .
- foreach v of var comp_post_stent*___3 {
- replace stentSepsis = 0 if `v' == 0
- }
- foreach v of var comp_post_stent*___3 {
- replace stentSepsis = 1 if `v' == 1
- }
- gen stentDVT = .
- foreach v of var comp_post_stent*___4 {
- replace stentDVT = 0 if `v' == 0
- }
- foreach v of var comp_post_stent*___4 {
- replace stentDVT = 1 if `v' == 1
- }
- gen stentMors = .
- foreach v of var comp_post_stent*___5 {
- replace stentMors = 0 if `v' == 0
- }
- foreach v of var comp_post_stent*___5 {
- replace stentMors = 1 if `v' == 1
- }
- gen stentNeuroKomp = .
- foreach v of var comp_post_stent*___6 {
- replace stentNeuroKomp = 0 if `v' == 0
- }
- foreach v of var comp_post_stent*___6 {
- replace stentNeuroKomp = 1 if `v' == 1
- }
- //5 pt for neuro
- gen stentHydro = .
- foreach v of var comp_post_stent*___7 {
- replace stentHydro = 0 if `v' == 0
- }
- foreach v of var comp_post_stent*___7 {
- replace stentHydro = 1 if `v' == 1
- }
- gen stentKramper = .
- foreach v of var comp_post_stent*___10 {
- replace stentKramper = 0 if `v' == 0
- }
- foreach v of var comp_post_stent*___10 {
- replace stentKramper = 1 if `v' == 1
- }
- //alle andre patienter 0 komp..
- /////////////////////STENT PERI/////////////////////////////////
- gen stentPerStentTrombo = .
- foreach v of var peropperative_comp_stent*___1 {
- replace stentPerStentTrombo = 0 if `v' == 0
- }
- foreach v of var peropperative_comp_stent*___1 {
- replace stentPerStentTrombo = 1 if `v' == 1
- }
- gen stentPerStentBrist = .
- foreach v of var peropperative_comp_stent*___2 {
- replace stentPerStentBrist = 0 if `v' == 0
- }
- foreach v of var peropperative_comp_stent*___2 {
- replace stentPerStentBrist = 1 if `v' == 1
- }
- gen stentPerStentAndet = .
- foreach v of var peropperative_comp_stent*___3 {
- replace stentPerStentAndet = 0 if `v' == 0
- }
- foreach v of var peropperative_comp_stent*___3 {
- replace stentPerStentAndet = 1 if `v' == 1
- }
- ////////////////////////COIL POST/////////////////////////////
- gen coilInfekt = .
- foreach v of var comp_post_coil*___1 {
- replace coilInfekt = 0 if `v' == 0
- }
- foreach v of var comp_post_coil*___1 {
- replace coilInfekt = 1 if `v' == 1
- }
- gen coilHematom = .
- foreach v of var comp_post_coil*___2 {
- replace coilHematom = 0 if `v' == 0
- }
- foreach v of var comp_post_coil*___2 {
- replace coilHematom = 1 if `v' == 1
- }
- //1 pt i heme
- gen coilSepsis = .
- foreach v of var comp_post_coil*___3 {
- replace coilSepsis = 0 if `v' == 0
- }
- foreach v of var comp_post_coil*___3 {
- replace coilSepsis = 1 if `v' == 1
- }
- gen coilDVT = .
- foreach v of var comp_post_coil*___4 {
- replace coilDVT = 0 if `v' == 0
- }
- foreach v of var comp_post_coil*___4 {
- replace coilDVT = 1 if `v' == 1
- }
- gen coilMors = .
- foreach v of var comp_post_coil*___5 {
- replace coilMors = 0 if `v' == 0
- }
- foreach v of var comp_post_coil*___5 {
- replace coilMors = 1 if `v' == 1
- }
- gen coilNeuroTromb = .
- foreach v of var comp_post_coil*___6 {
- replace coilNeuroTromb = 0 if `v' == 0
- }
- foreach v of var comp_post_coil*___6 {
- replace coilNeuroTromb = 1 if `v' == 1
- }
- //1 pt
- gen coilHydro = .
- foreach v of var comp_post_coil*___7 {
- replace coilHydro = 0 if `v' == 0
- }
- foreach v of var comp_post_coil*___7 {
- replace coilHydro = 1 if `v' == 1
- }
- gen coilAndet = .
- foreach v of var comp_post_coil*___8 {
- replace coilAndet = 0 if `v' == 0
- }
- foreach v of var comp_post_coil*___8 {
- replace coilAndet = 1 if `v' == 1
- }
- //1 pt
- gen coilKramper = .
- foreach v of var comp_post_coil*___10 {
- replace coilKramper = 0 if `v' == 0
- }
- foreach v of var comp_post_coil*___10 {
- replace coilKramper = 1 if `v' == 1
- }
- //1 pt
- ////////////////////////////COIL PERI////////////////////////////
- gen coilPeriTrombo = .
- foreach v of var peropperative_comp_coil*___1 {
- replace coilPeriTrombo = 0 if `v' == 0
- }
- foreach v of var peropperative_comp_coil*___1 {
- replace coilPeriTrombo = 1 if `v' == 1
- }
- //2 pt
- gen coilPeriBrist = .
- foreach v of var peropperative_comp_coil*___2 {
- replace coilPeriBrist = 0 if `v' == 0
- }
- foreach v of var peropperative_comp_coil*___2 {
- replace coilPeriBrist = 1 if `v' == 1
- }
- //7 pt
- gen coilPeriAndet = .
- foreach v of var peropperative_comp_coil*___3 {
- replace coilPeriAndet = 0 if `v' == 0
- }
- foreach v of var peropperative_comp_coil*___3 {
- replace coilPeriAndet = 1 if `v' == 1
- }
- //3 pt
- ////////////////////////COMP POST SURG//////////////////////////
- gen surgInfekt = .
- foreach v of var comp_post_surgery*___1 {
- replace surgInfekt = 0 if `v' == 0
- }
- foreach v of var comp_post_surgery*___1 {
- replace surgInfekt = 1 if `v' == 1
- }
- //4 pt
- gen surgSepsis = .
- foreach v of var comp_post_surgery*___3 {
- replace surgSepsis = 0 if `v' == 0
- }
- foreach v of var comp_post_surgery*___3 {
- replace surgSepsis = 1 if `v' == 1
- }
- //1 pt
- gen surgDVT = .
- foreach v of var comp_post_surgery*___4 {
- replace surgDVT = 0 if `v' == 0
- }
- foreach v of var comp_post_surgery*___4 {
- replace surgDVT = 1 if `v' == 1
- }
- gen surgMors = .
- foreach v of var comp_post_surgery*___5 {
- replace surgMors = 0 if `v' == 0
- }
- foreach v of var comp_post_surgery*___5 {
- replace surgMors = 1 if `v' == 1
- }
- gen surgNeuroTrombo = .
- foreach v of var comp_post_surgery*___6 {
- replace surgNeuroTrombo = 0 if `v' == 0
- }
- foreach v of var comp_post_surgery*___6 {
- replace surgNeuroTrombo = 1 if `v' == 1
- }
- //23 pt
- gen surgHydro = .
- foreach v of var comp_post_surgery*___7 {
- replace surgHydro = 0 if `v' == 0
- }
- foreach v of var comp_post_surgery*___7 {
- replace surgHydro = 1 if `v' == 1
- }
- gen surgAndet = .
- foreach v of var comp_post_surgery*___8 {
- replace surgAndet = 0 if `v' == 0
- }
- foreach v of var comp_post_surgery*___8 {
- replace surgAndet = 1 if `v' == 1
- }
- //15 pt
- gen surgPostOpHema = .
- foreach v of var comp_post_surgery*___9 {
- replace surgPostOpHema = 0 if `v' == 0
- }
- foreach v of var comp_post_surgery*___9 {
- replace surgPostOpHema = 1 if `v' == 1
- }
- //4 pt
- gen surgKramper = .
- foreach v of var comp_post_surgery*___10 {
- replace surgKramper = 0 if `v' == 0
- }
- foreach v of var comp_post_surgery*___10 {
- replace surgKramper = 1 if `v' == 1
- }
- //1 pt
- ////////////////////////COMP PERI SURG/////////////////////////
- //Bristning
- gen surgPeriBrist = .
- foreach v of var peropper_compli*___1 {
- replace surgPeriBrist = 0 if `v' == 0
- }
- foreach v of var peropper_compli*___1 {
- replace surgPeriBrist = 1 if `v' == 1
- }
- //2 pt
- gen surgPeriAndet = .
- foreach v of var peropper_compli*___2 {
- replace surgPeriAndet = 0 if `v' == 0
- }
- foreach v of var peropper_compli*___2 {
- replace surgPeriAndet = 1 if `v' == 1
- }
- //6 pt
- /////////////////////////////POST COMP STENT+COIL////////////////////////////////
- gen scInfekt = .
- foreach v of var complic_post_co_st*___1 {
- replace scInfekt = 0 if `v' == 0
- }
- foreach v of var complic_post_co_st*___1 {
- replace scInfekt = 1 if `v' == 1
- }
- //1 pt
- gen scHema = .
- foreach v of var complic_post_co_st*___2 {
- replace scHema = 0 if `v' == 0
- }
- foreach v of var complic_post_co_st*___2 {
- replace scHema = 1 if `v' == 1
- }
- //3 pt
- gen scSepsis = .
- foreach v of var complic_post_co_st*___3 {
- replace scSepsis = 0 if `v' == 0
- }
- foreach v of var complic_post_co_st*___3 {
- replace scSepsis = 1 if `v' == 1
- }
- gen scDVT = .
- foreach v of var complic_post_co_st*___4 {
- replace scDVT = 0 if `v' == 0
- }
- foreach v of var complic_post_co_st*___4 {
- replace scDVT = 1 if `v' == 1
- }
- gen scMors = .
- foreach v of var complic_post_co_st*___5 {
- replace scMors = 0 if `v' == 0
- }
- foreach v of var complic_post_co_st*___5 {
- replace scMors = 1 if `v' == 1
- }
- gen scNeurotromb = .
- foreach v of var complic_post_co_st*___6 {
- replace scNeurotromb = 0 if `v' == 0
- }
- foreach v of var complic_post_co_st*___6 {
- replace scNeurotromb = 1 if `v' == 1
- }
- //18 pt
- gen scHydro = .
- foreach v of var complic_post_co_st*___7 {
- replace scHydro = 0 if `v' == 0
- }
- foreach v of var complic_post_co_st*___7 {
- replace scHydro = 1 if `v' == 1
- }
- gen scAndet = .
- foreach v of var complic_post_co_st*___8 {
- replace scAndet = 0 if `v' == 0
- }
- foreach v of var complic_post_co_st*___8 {
- replace scAndet = 1 if `v' == 1
- }
- //7 pt
- gen scKramper = .
- foreach v of var complic_post_co_st*___10 {
- replace scKramper = 0 if `v' == 0
- }
- foreach v of var complic_post_co_st*___10 {
- replace scKramper = 1 if `v' == 1
- }
- /////////////////////PERI SC//////////////////////////
- gen scPeriTromboembo = .
- foreach v of var perop_comp_co_st_coil*___1 {
- replace scPeriTromboembo = 0 if `v' == 0
- }
- foreach v of var perop_comp_co_st_coil*___1 {
- replace scPeriTromboembo = 1 if `v' == 1
- }
- //2 pt
- gen scPeriBrist = .
- foreach v of var perop_comp_co_st_coil*___2 {
- replace scPeriBrist = 0 if `v' == 0
- }
- foreach v of var perop_comp_co_st_coil*___2 {
- replace scPeriBrist = 1 if `v' == 1
- }
- //3 pt
- gen scPeriAndet = .
- foreach v of var perop_comp_co_st_coil*___3 {
- replace scPeriAndet = 0 if `v' == 0
- }
- foreach v of var perop_comp_co_st_coil*___3 {
- replace scPeriAndet = 1 if `v' == 1
- }
- /////////////////infektion////////////////////
- gen infektion = 0 if !missing(stentInfekt, coilInfekt, surgInfekt, scInfekt)
- replace infektion = 1 if stentInfekt == 1 | coilInfekt == 1 | surgInfekt == 1 | scInfekt == 1
- ///////////////sepsis////////////////////
- gen sepsis = 0 if !missing(stentSepsis, coilSepsis, surgSepsis, scSepsis)
- replace sepsis = 1 if stentSepsis == 1 | coilSepsis == 1 | surgSepsis == 1 | scSepsis == 1
- /////////////////DVT///////////////////
- gen DVT = 0 if !missing(stentDVT, coilDVT, surgDVT, scDVT)
- replace DVT = 1 if stentDVT == 1 | coilDVT == 1 | surgDVT == 1 | scDVT == 1
- ////////////////neurotromb//////////////////
- gen neurotromb = 0 if !missing(stentNeuroKomp, coilNeuroTromb, surgNeuroTrombo, scNeurotromb)
- replace neurotromb = 1 if stentNeuroKomp == 1 | coilNeuroTromb == 1 | surgNeuroTrombo == 1 | scNeurotromb == 1
- ///melogit compAtAll treatmentChoice || anIdentify:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement