Hello,
I would like the following to drop a certain cohort for only one of the files but not the other. It seems that when I ask it to display "`drop_study'" it only shows
if cohort == study9
and not
if cohort == "study9"
local filepaths = "filepath1 filepath2"
foreach filepath of local filepaths{
use "`filepath'", clear
if regexm("`filepath'","1") local drop_study = `"if cohort == ""study9"""'
if regexm("`filepath'","2") local drop_study = `""'
drop `drop_study'
}
I would like the following to drop a certain cohort for only one of the files but not the other. It seems that when I ask it to display "`drop_study'" it only shows
if cohort == study9
and not
if cohort == "study9"
local filepaths = "filepath1 filepath2"
foreach filepath of local filepaths{
use "`filepath'", clear
if regexm("`filepath'","1") local drop_study = `"if cohort == ""study9"""'
if regexm("`filepath'","2") local drop_study = `""'
drop `drop_study'
}

Comment