Creating dummy variables for state pairs

#1
Can anyone help please. I have data set and i am trying to generate a state pair dummy that shows 1 if either or both of the states has a dummy 1 and 0 only if both state pair have a dummy 0. Secondly, i'm trying to generate a variable for each state pair i have created, this variable should be the log of the ratio of prices of a commodity for each state pair. Thank you.