No it is not an anxiety attack. Usually prior to an upper or lower G.I endoscopy, a sedative is given to help the patient relax. This could be causing your yawning. It will resolve itself in a 8 to 12 hours.