BookmarkSubscribeRSS Feed
Tom
Super User Tom
Super User

I think you a missing a key concept of how autosave works. There are a lot of limitations on what it can do.  The main idea is that you can tell SAS to periodically save a copy of whatever you have in the program editor into a specific place.  It is not going to try to save the file you are editing.  

How would the editor even know what file you are editing?  You can open file X with the intent of making changes and saving it as file Y.  In that case your would NOT want SAS to make any changes to X.

By default it just makes a file name pgm.asv, but you can change that using the options.

AUTOSAVELOC= 

AUTOSAVELOC= (unix) 

 

There are also commands for controlling whether/when to autosave:

WAUTOSAVE DMS command 

SETAUTOSAVE DMS command (unix) 

n6
Quartz | Level 8 n6
Quartz | Level 8

It seems that it is saving the file I'm editing.  I did as I described a few posts ago and it works.  I have a subfolder and I point there via options autosave= and then when I change the SAS program I'm working on in the Program Editor, every five minutes it saves it in that subfolder I specified.  If I don't change the program at all it doesn't save it, but if I change it, then SAS saves it.

 

I just tried it again.  The only change I made to the progam in the Program Editor is I hit the return key once.  And a few minutes later, it save the program in that subfolder.

Tom
Super User Tom
Super User

@n6 wrote:

It seems that it is saving the file I'm editing.  I did as I described a few posts ago and it works.  I have a subfolder and I point there via options autosave= and then when I change the SAS program I'm working on in the Program Editor, every five minutes it saves it in that subfolder I specified.  If I don't change the program at all it doesn't save it, but if I change it, then SAS saves it.

 

I just tried it again.  The only change I made to the progam in the Program Editor is I hit the return key once.  And a few minutes later, it save the program in that subfolder.


Are you using PC SAS? What happens when you have two files open and you make changes to both? Does it save both files to their original location? Does it save both files to the same location so that the last one saved is all that is available?

 

What if you have one file open in the normal program editor (the one that works on Unix also and supports commands in the line number area) and the "enhanced" editor?

 

At one point you could point the AUTOSAVELOC to a DIRECTORY but that functionality seems to be missing in the current documentation and I remember that it seemed to change at one point.

n6
Quartz | Level 8 n6
Quartz | Level 8

I don't know if I"m using PC SAS.  I'm using SAS on a PC.

 

I never have two files open of the same name so that doesn't matter.  But what you wrote did make me think of something potentially bad.

 

1. You open SAS and it has default options.

 

2. You open program xyz and run the autosave code so that it is going to autosave your xyz.sas program in a certain place.

 

3. You're finished for now with program xyz, so you clear your Program Editor window and then open up program abc instead.

 

4. But since options hold for your entire SAS session unless you change them, after you start editing program abc, after a few minutes it will autosave abc in wherever the options tells it to, which is where you autosave program xyz.  Thus, you could inadvertently overwrite the autosaved version of xyz.

 

5. If you wanted, you could do a new autosave line for program abc as soon as you opened abc, but it's possible that the clock ticking to do the autosave will hit the limit after you open program abc but before you've submitted the autosave line for program abc, thus saving program abc in the place where program xyz is supposed to be.

 

6. One way around all this is to close SAS entirely after you're finished working on a program and then re-open it to work on your next program, but that would be a pain and plus you'd probably sometimes forget.

 

7. Then again, if the only time you need the autosaved program is when SAS crashes while you're working on a program, then it might be okay.  Let it overwrite the autosaved xyz with abc because after I'm done with xyz, I save the main program before clearing the Program Editor window and thus if the autosaved version of xyz gets autosaved over, so what?

SASKiwi
PROC Star

@n6 - There are three SAS programming interfaces you can choose from. The one you are using is the SAS Windowing Environment, which is installed by default with Base SAS. This is essentially a legacy interface that is just maintained and does not get any enhancements.

 

There are two newer interfaces, SAS Studio and SAS Enterprise Guide that are being continuously enhanced. This link will help you learn about these: https://support.sas.com/software/products/sas-studio/faq/SASStudio_vsEG.htm

 

Please note you could use either SAS Studio or SEG on a standalone PC, although that usually requires additional installation and configuration.

Tom
Super User Tom
Super User

PC SAS is just short hand to mean running SAS Display Manager on Windows. Instead of running SAS on Unix or Z/OS (or VMS if it still existed) operating system. Or instead of running Enterprise Guide or SAS/Studio or some other interface instead of Display Manager.

 

As I said before the idea of the autosave feature is where is it going to dump a copy of what is in the editor, in case you crash SAS or exit without saving.  I am not sure any value is added by going to too much work to constantly be pointing that location different places.

 

The default is to just write to pgm.asv in the current directory.  Which might work ok for those that launch SAS by moving to a particular current directory and then running the SAS command at the command prompt.  (although that can be a problem when working as a team)  But with typical Windows installations of SAS that is not how SAS is normally launched.  Instead you click on some icon on your desktop (or pick an icon from the "START" menu) or a command is selected for you based on the executable program associated with the file you click on.  None of those methods normally will change the current directory to the location where the file you want to edit is located.  Instead the current working directory is just some arbitrary location setup when the ICON was defined that you used to launch SAS.

 

The whole concept of dumping the contents of the program editor to a file doesn't really make much sense to me as some that uses SAS display manager.  It is not like SAS is just a text editor. SAS Display Manager is an interactive development environment. What I currently have in the program editor window might just be one step of a many step program that I am working on.  It might even just be some code I am playing with to figure out how to write the program I am working on.  Or how to check the outputs of the steps I ran before that might become part of a program.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 20 replies
  • 4927 views
  • 7 likes
  • 6 in conversation