BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.

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.

The Boston Area SAS Users Group is hosting free webinars!
Next up: Joe Madden & Joseph Henry present Putting Power into the Hands of the Programmer with SAS Viya Workbench on Wednesday Nov 6.
Register now at https://www.basug.org/events.
1 ACCEPTED SOLUTION

Accepted Solutions
gamotte
Rhodochrosite | Level 12

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.

View solution in original post

16 REPLIES 16
Quentin
Super User

Just noticed the "safe save" configuration option of the enhanced editor:

 

Customizing Your SAS Session

Safe save (Enhanced Editor only)
enables the Safe save option, which creates a temporary file and then renames it to the original filename
 
Seems likely this is creating the .tmp files and then failing to rename them and/or failing to delete them?  It's happening again today, but I can't recreate it reliably (i.e. doesn't happen every time I hit save). 
The Boston Area SAS Users Group is hosting free webinars!
Next up: Joe Madden & Joseph Henry present Putting Power into the Hands of the Programmer with SAS Viya Workbench on Wednesday Nov 6.
Register now at https://www.basug.org/events.
gamotte
Rhodochrosite | Level 12

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.

Quentin
Super User

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.

The Boston Area SAS Users Group is hosting free webinars!
Next up: Joe Madden & Joseph Henry present Putting Power into the Hands of the Programmer with SAS Viya Workbench on Wednesday Nov 6.
Register now at https://www.basug.org/events.
ballardw
Super User

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.

Quentin
Super User

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:

  1. write SAS###.tmp
  2. after writing of .tmp completes successfully, overwrite myfile.sas with SAS###.tmp
The Boston Area SAS Users Group is hosting free webinars!
Next up: Joe Madden & Joseph Henry present Putting Power into the Hands of the Programmer with SAS Viya Workbench on Wednesday Nov 6.
Register now at https://www.basug.org/events.
ballardw
Super User

@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:

  1. write SAS###.tmp
  2. 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.

Quentin
Super User

 


@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.

The Boston Area SAS Users Group is hosting free webinars!
Next up: Joe Madden & Joseph Henry present Putting Power into the Hands of the Programmer with SAS Viya Workbench on Wednesday Nov 6.
Register now at https://www.basug.org/events.
ballardw
Super User

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.

Quentin
Super User

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.

The Boston Area SAS Users Group is hosting free webinars!
Next up: Joe Madden & Joseph Henry present Putting Power into the Hands of the Programmer with SAS Viya Workbench on Wednesday Nov 6.
Register now at https://www.basug.org/events.
BruceBrad
Lapis Lazuli | Level 10

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'?

Quentin
Super User

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:

  1. Write .tmp file.
  2. Delete .sas file
  3. Rename .tmp file to .sas

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.

The Boston Area SAS Users Group is hosting free webinars!
Next up: Joe Madden & Joseph Henry present Putting Power into the Hands of the Programmer with SAS Viya Workbench on Wednesday Nov 6.
Register now at https://www.basug.org/events.
BruceBrad
Lapis Lazuli | Level 10

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.

Quentin
Super User

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. : )

The Boston Area SAS Users Group is hosting free webinars!
Next up: Joe Madden & Joseph Henry present Putting Power into the Hands of the Programmer with SAS Viya Workbench on Wednesday Nov 6.
Register now at https://www.basug.org/events.
BruceBrad
Lapis Lazuli | Level 10

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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 16 replies
  • 4101 views
  • 2 likes
  • 4 in conversation