Dear All
First time poster. Using Stata 15.1 on Windows.
I am doing a epidemiologic register study on adverse events in colonoscopy. So for each colonoscopy I want to check if the same individual/same id came in with a bleeding or perforation the next 30 days. The data sett is very large with 32 million entries in two files.
This is the code I found that I was trying out, just to do a simple loop. What I want to do is just when colonoscopy == 1 then do a lot more only if colonoscopy == 1.
foreach var in colonoscopy {
if _rc==0 {
//Check if the same id has an Perforation the next 30 days.
//Only if colonoscopy == 1
}
}
But it it enters the loop even if colonoscopy is blank or 0.
How can i do this so it enters only if colonoscopy is equal to 1?
Here is sample of the dummy test dataset.
Thanks in advance
Bjarki
First time poster. Using Stata 15.1 on Windows.
I am doing a epidemiologic register study on adverse events in colonoscopy. So for each colonoscopy I want to check if the same individual/same id came in with a bleeding or perforation the next 30 days. The data sett is very large with 32 million entries in two files.
This is the code I found that I was trying out, just to do a simple loop. What I want to do is just when colonoscopy == 1 then do a lot more only if colonoscopy == 1.
foreach var in colonoscopy {
if _rc==0 {
//Check if the same id has an Perforation the next 30 days.
//Only if colonoscopy == 1
}
}
But it it enters the loop even if colonoscopy is blank or 0.
How can i do this so it enters only if colonoscopy is equal to 1?
Here is sample of the dummy test dataset.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input byte id float(colonoscopy Perforation) 1 . . 1 . . 1 . . 2 . . 2 . . 2 1 . 2 . . 2 . 1 2 . 1 2 . . 2 . . 2 . . 2 . . 2 . . 2 . . 2 . . 2 . . 1 . . 3 . . 3 . . end
Thanks in advance
Bjarki
Comment