Before imposing sentence a court shall disclose the report of the presentence investigation to the defendant, the defendant's counsel, if represented by counsel, and the prosecuting attorney, but the court may exclude any recommendation as to sentence, and other material that, in the opinion of the court, contains a diagnostic opinion which might seriously disrupt a program of rehabilitation, sources of information obtained upon a promise of confidentiality, or any other information which, if disclosed, might result in harm, physical or otherwise, to the defendant or other persons. The court shall afford the defendant, the defendant's counsel, or the prosecuting attorney an opportunity to comment thereon and, in the discretion of the court, to introduce testimony or other information relating to any alleged factual inaccuracy contained in the presentence report.
SDCL 23A-27-7