Dear STATA Fraternity

I am not good in writing codes. Somehow i tried to write a code for calculating idiosyncratic skewness. But it doesn't work probably due to some bug. I am attaching both the code as well as sample data csv file. Hope some expert will help me out. i am tagging to some experts who have already provided assistance on this.