When a file is open, Panorama simply keeps a list of permanent variable names. The permanent statement creates a fileglobal variable, and adds the name to the list.
When the file is saved, Panorama goes thru the list of permanent variables, and saves the variables and their values into the saved file. Each is actually saved as a pair -- I can't see any way that the name could be saved without a value.
When the file is opened, Panorama restores the list of permanent variable names from the disk. It then creates a fileglobal with that name and loads the value from the disk file. From that point forward there is no actual "permanent variable", just a fileglobal variable with a name in a list.
So the answer to your question is -- permanent variables don't really exist when a database is open. All there is is a list of the permanent variable names -- no values.
As I said I can't se any way that a permanent variable could be saved without a value. However, in Panorama X that value could be the error "variable does not exist". So it could be that something happened to the fileglobal value before the file is saved. In that case the permanent variable would be correctly saving the value "variable does not exist."
Of course that just possibly leaves a different mystery -- what happened to the fileglobals? There haven't been any reports of missing fileglobals. Of course normally if Panorama crashed or hung you would have no way of knowing what the value of a fileglobal was. It sounds like something happened that would eventually cause the crash or hang, but perhaps the Apple auto-save kicked in and saved the file in the middle of that.
I'm sure someone is going to suggest that in that situation Panorama should just resave the original permanent variable contents from when the file was opened. Let me shoot that down -- there is no record of those values after the open process is completed (other than the fileglobal variable values, of course, but those are apparently compromised).
What might be possible would be to refuse to save at all if the variables are compromised. Assuming, of course, that this is really the problem, this is really just speculation on my part. I've written up this speculation as a bug report.