I don't believe the code gets stored anywhere, but you might get a "emissions system not ready" error when they try to run it thru the emissions testing. I had the exact same thing happen. I've had the P0401 code since I got my truck and had to get it inspected for the first time to get it registered in NJ. Anyway, I went to Autozone to clear the code, then went straight to inspection. Failed with a "not ready" error. Was bummed cuz I wanted to resolve the EGR code on my own time, not under the gun. Came back to office, searched these forums and found I needed to drive it a few miles (20 - 30 or so) to get the systems in a ready state. Drove down the highway and back for a total of maybe 35 miles, pulled into inspection station with 10 minutes till close time, it passed! Drove down the road to go home and P0401 came back within 2 minutes.
More info than you need of course.
EDIT: I believe I was wrong about codes not being stored. Oops.