I have a code that looks like the below (minimum working example). A loop that loops through 2 scenarios. Each scenario will use a different sample.
For some samples I want to run some stata commands whereas for others I don't. The if statement if `data_sample' == "sample1", does not seem to work and I cannot figure out why.

Any help would be appreciated.

Nathan



Code:
local scenario_list 1 2

foreach scenario of local scenario_list {    

use "${tempdata}/final_dataset2.dta", clear

if `scenario' == 1 {
    
    local data_sample = "sample1"
    *some drop keep statements here
    }
    else if `scenario' == 2 {
    local data_sample = "sample2"
   * some drop keep statements here
    }

if `data_sample' == "sample1"
   *do some stuff here
}

}