I agree with Yolanda.
"In doing so" is a little more on the side of possibility rather than reality, but very difficult to explain. I �ll try with this example.
He spoke very bluntly to his boss. In doing so, he hurt his chances of a promotion. [It isn �t easy to see, but this sentence is a little hypothetical, but very little]
He spoke very bluntly to his boss. By doing so, he hurt his chances of a promotion. [This sentence is very real and definite]
"Doing so" would be a gerund, which behaves like a noun:
He spoke very bluntly to his boss. Doing so hurt his chances of a promotion. [The meaning is the same as "by doing so", but it becomes the subject of the sentence]
The difference in meaning is so slight that there �s no danger of being misunderstood using any of the three options.
Bruce