Hi,

I'm trying to merge two datasets (Disease_reshaped and DevelopmentStage) for only specific observations of a "Disease" variable in the Disease_reshaped dataset. The goal is to create a dataset that merges data for just these observation values. I first created a local of these specific observation values and then created a loop to merge based on just these observation values. However, when running the loop as below, I get the following error "Asthma not found" where the observation value mentioned in the local is reported as not found. This happens for all the values mentioned in the local (i.e. even when I change the order in the local). The values in the local are mentioned as they are found in the dataset. Any guidance on how to resolve this will be much appreciated. Thank you.


Code:
#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", replace
    keep if Disease == `class'
    merge 1:m DrugNameX using "${datadir}\Pharmaprojects_DevelopmentStage_step1" 
    }