If a vacancy occurs within thirty days preceding an election day at which it may be filled, no appointment shall be made unless it be necessary to carry out such election and the canvass of the same according to law; in that case an appointment may be made at any time previous to such election to hold until after such election or until a successor is elected and qualified.
SDCL 3-4-5