When calculating strike percentage, divide total strikes by total number of frames. In the case of strikes it would be 12 frames because a game can yield 12 possible strikes.
When calculating spare percentage, divide total spares by total number of frames minus strikes. In the case of spares it would be 10 frames because a game can yield 10 possible spares.
If you want to get real technical, you can factor in close to impossible splits. In that case you would subtract the number of frames that yielded close to impossible splits from the number of total frames. In addition, of course, you would subtract the number of strikes thrown.
That is the way I like to do. Another way to consider is, disecting the 10th frame for each game. If you throw a strike and a spare in the 10th, you would still calculate spare percentage based on 10 potentional spares. If you throw 2 strikes and a 9 or whatever it may be in the 10th, you would calculate the game based on 9 frames where possible spares may occur.