I'm trying to create a situation where I can check a set of country/state names (education_SP) to see if they are US states, and then if they are not US states, to populate a (mostly blank) second variable (education_country) with that country name. If they do end up being US states, I'll put "USA" in the new variable.
I put the code I'm attempting below.
The prime thing I'm struggling with is working out how to create a dictionary of the 50 US States (will include PR, DC, and Guam) that I can use a logical operator to check against.
Thanks so much for your time; this site has been a pretty great learning resource for me.
Code:
local var stateList = {"Alabama", "Alaska", "Arizona", "Arkansas"}
replace education_country = education_SP if education_country == "" & education_SP ! in local(stateList)
replace education_country = "USA" if education_country == "" & education_SP in local(stateList)
0 Response to Flow Control
Post a Comment