Deductions & credits

Sure.  Doesn't matter what you do with the proceeds.  But you still pay the capital gains tax if any.  I don't think you can roll it over to the other one.