The INSPECT statement can be used to tally the number of occurrences of specific character strings, to replace characters by…