Hi
I have a variable 'operative procedure' which lists operation codes which are strings. These codes can be grouped for example 'right hemicolectomy' might take on code h079 or h071. I want to count the number of right hemicolectomies per patient. I need to create a loop that will allow me to define other procedures should as 'total colectomy' which will also have multiple codes and hence need to create a loop for this.
local righthemi `" "h071" "h079" "'
foreach v of varlist opcs {
count if `v' == `righthemi'
}
when i use this syntax i get an error code saying invalid '"h079'
any advice on how to approach the problem?
I have a variable 'operative procedure' which lists operation codes which are strings. These codes can be grouped for example 'right hemicolectomy' might take on code h079 or h071. I want to count the number of right hemicolectomies per patient. I need to create a loop that will allow me to define other procedures should as 'total colectomy' which will also have multiple codes and hence need to create a loop for this.
local righthemi `" "h071" "h079" "'
foreach v of varlist opcs {
count if `v' == `righthemi'
}
when i use this syntax i get an error code saying invalid '"h079'
any advice on how to approach the problem?
Comment