Hi. The local below comprises of observation values within a variable "Disease". I am to merge two datasets only for the observation values mentioned in the local. However, the code in the loop deletes each disease case/observation value in the local before running the next. So, instead of getting a new dataset which has merged values for all the observation values in "classList", I only get a dataset merged for the last observation value "Cancer, solid, unspecified". What am I missing here? Any help would be much appreciated. Thanks.

Code:
clear 

#delimit ;
local classList
    Asthma
    "Pain, nociceptive, general"
    "Cancer, unspecified"
    "Hypertension, unspecified"
    "Inflammatory disease, unspecified"
    "Cancer, breast"
    "Infection, HIV/AIDS"
    "Diabetes, Type 2"
    "Arthritis, rheumatoid"
    "Cancer, solid, unspecified"
;

#delimit cr


foreach class of local classList {
    use "${datadir}\Pharmaprojects_Disease_reshaped", clear
    keep if Disease == "`class'"
    merge 1:m DrugNameX using "${datadir}\Pharmaprojects_DevelopmentStage_step1", keep(match)
    save "${dodir}\Disease+Stage", replace
    }