How do I set a value within an if statement using logic gates?
You have not mentioned what happens when A = 0. Should B hold the previous value? If that is the case, you need a latch or a Flip-Flop.

If all you want to do is set B when A = 1, why don't you directly connect B to A?
You can also use a buffer (2 NOT gates in series) to connect B to A.

When A = 1, B will be set to 1.


When A = 0, B will be set to 0.