I am using the formula described here for PER:
en.wikipedia.org/wiki/Player_efficiency_rating
The PER formula is too complex for me to understand and check my work, but I was able to copy and paste the formula into my code and I think it is right
PPP is points per possession which is a lot simpler, just the points divided by the number of possessions. I found something on the internet that explained how to determine the number of possessions based on the stats.