I'm using Display Manager PC SAS 9.4M4, enhanced editor on Win10.
Yesterday I noticed a number of files were created in my code directory, with names like SAS5A28.tmp. When I open the files, they are clearly temporary versions of the .sas file I was editing.
We have a new automated backup solution running locally. I asked the owners of that if they create .tmp files, and they said no. My next thought is that SAS is creating these temporary files in the background (either periodically, or when I save a file), and the SAS would normally delete them after a successful save, but perhaps the files are being locked by the new backup process. Of course the owners of the backup process claims it ignores .tmp files...
More suspicious is there were several times yesterday where I pressed Ctrl+S and the .sas file did not save (or at least the little unsaved asterisk did not go away) until I hit Ctrl+S again. Making me think it's more likely that a backup or virus scan or whatever is causing some temporary file locks.
Hello,
With a SAS program opened on one screen, a file explorer at the program location on the other, i managed
to make such temporary files sporadically appear by repeatedly pressing CTRL+S, so it confirms that those files
are created then deleted by the SAS saving process.
Just noticed the "safe save" configuration option of the enhanced editor:
Customizing Your SAS Session
Hello,
With a SAS program opened on one screen, a file explorer at the program location on the other, i managed
to make such temporary files sporadically appear by repeatedly pressing CTRL+S, so it confirms that those files
are created then deleted by the SAS saving process.
Thanks @gamotte I've tried the same but can't get them to pop up in explorer then disappear. Good to know it is the SAS save process. Guess I'll have to decide between disabling the safe save (seems risky) and pausing the new backup tool when I'm working in SAS.
Those TMP files should go away when you have a clean shut down of SAS or after closing the file from the editor.
Personally I wouldn't worry about the tmp code files.
Unfortunately @ballardw they don't go away with a clean close of SAS. (Because they were supposed to disappear automatically as part of the file save process). So after working yesterday, I had 5 .tmp files in the directory this morning (I probably hit crt+S a few hundred times yesterday). Working this morning, I've added two or three more.
I haven't figured out yet if the file SAVE is actually not working when this problem occurs (because I can't replicate it), but my guess is it's not. At one point this morning I had a .tmp file that was newer (by windows timestamp) than my .sas file. I think that suggests that when I save myfile.sas, the save process is something like:
@Quentin wrote:
Unfortunately @ballardw they don't go away with a clean close of SAS. (Because they were supposed to disappear automatically as part of the file save process). So after working yesterday, I had 5 .tmp files in the directory this morning (I probably hit crt+S a few hundred times yesterday). Working this morning, I've added two or three more.
I haven't figured out yet if the file SAVE is actually not working when this problem occurs (because I can't replicate it), but my guess is it's not. At one point this morning I had a .tmp file that was newer (by windows timestamp) than my .sas file. I think that suggests that when I save myfile.sas, the save process is something like:
- write SAS###.tmp
- after writing of .tmp completes successfully, overwrite myfile.sas with SAS###.tmp
Were the program files closed from inside SAS or were they active in the editor window when SAS was closed? I suspect the TMP files exist as long as the base file is active in the Editor.
You may also have to describe your environment. Servers vs stand-alone installations and SAS Studio vs Display Manager likely have somewhat different behaviors.
@ballardw wrote:Were the program files closed from inside SAS or were they active in the editor window when SAS was closed? I suspect the TMP files exist as long as the base file is active in the Editor.
You may also have to describe your environment. Servers vs stand-alone installations and SAS Studio vs Display Manager likely have somewhat different behaviors.
The files would have been still open in the SAS enhanced editor window when SAS was closed. But I'd be surprised if that's relevant (I almost always have a program open in the enhanced editor when I quit SAS). Have you seen these .tmp files before? I haven't ever seen them (in 20 years of SAS programming). Note they're different extension than the automatic backup files DM SAS can create.
Environment is described in my first post. No server. Display Manager PC SAS 9.4M4, enhanced editor on Win10.
By "code directory" do you mean the folder that the file you are editing resides in? If so, I am not seeing any such temp files. And I do have "show hidden files" active for Windows explorer.
Perhaps the temp files are created by the backup program you mentioned when it can't get a lock because SAS has the file in use.
Yes, by "code directory" I mean the folder where the .sas file I'm editing resides. I thought it might be the backup program, but they said they don't make .tmp files. @gamotte reported being able to sporadically see the temporary creation and deletion of .tmp files just by repeatedly hitting CTRL-S while watching in Windows explorer. I haven't been able to replicate that, but I take it as confirmation that it's SAS which is creating the .tmp files.
I'm having the same problem - but worse! That is, sometimes when I save a file, then quit SAS I find my .sas file has disappeared. All I'm left with is a SASxxxx.tmp file. Sometimes I can't open this until I logoff and back on because another process has locked it. When I do manage to open it, it does contain my missing SAS code.
Maybe it is relevant that on my system these files are on a network share and I have 'always available offline' ticked (though I am online).
I've contacted SAS tech support - but they have just suggested that this is file server problem. Should I disable 'safe save'?
Ugh, that is worse.
I suppose you could try disabling safe save. I haven't tried it yet, I'm still exploring.
I would try calling tech support again, and ask them with safe save on, what are steps when the enhanced editor saves a .sas file. From what you write it sounds like:
And somehow you are managing to win (lose) a race where SAS quits before it has done the rename?
For my case where I'm seeing both .tmp files and .sas files in same folder, I think it's possible my backup software is somehow locking the .sas file and preventing the deletion. Will play some more.
I did ask them this question, and they confirmed that this is how it operates.I'll try disabling safe save and see what happens.
Does it only happen when you guit SAS, and it asks "Do you want to save changes?" ? That would seems like potential race, especially if you are writing to a network drive far far away.
That is , if you hit Ctrl-S and it saves, then you quit SAS, do you ever get this problem? Just curious how bad it might get on my end. : )
It happens when I'm not quitting SAS as well. Pressing ctrl-S just creates a .tmp file. But not every time. Maybe one in three.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.