Open last used programs on startup

Reply
Occasional Contributor
Posts: 16

Open last used programs on startup

Hi,

it would be useful if on startup SAS opened the same programs I had open before exiting my previous SAS session.

Can this be done?

Super User
Super User
Posts: 7,970

Re: Open last used programs on startup

Posted in reply to gusfryk01

Well, its not straightforward.  What you need to do is to write open file windows to a file on shutdown, so maybe have a final.sas which runs on close down.  Then in your autoexec.sas (the file which runs at SAS startup) you could have commands:

DM 'wpgm';

DM 'include pathtofile\youfile.sas';

Do this for each file in the text file you saved earlier.  That would open each of the windows.  I don't know of an option to do this automatically.

Super User
Super User
Posts: 7,970

Re: Open last used programs on startup

Occasional Contributor
Posts: 16

Re: Open last used programs on startup

Thank you!

Do you mean that I should write each program to a separate file or all open programs to a single file?

Super User
Super User
Posts: 7,970

Re: Open last used programs on startup

Posted in reply to gusfryk01

Hi,

Just write a list of what you have open to a text - just the filenames, so that you can read that back in and use it to re-open files.  As SAS doesn't record the files that were open, you need to do that manually, then read that file in and use the filenames there to open those files.  I know what you mean though, in SharpDevlop/Eclipse etc. then you can set it to re-open the last project.  SAS doesn't have this function (at least base, haven't really used the other technologies - EG, DI etc).

Occasional Contributor
Posts: 16

Re: Open last used programs on startup

Yes, that is indeed what I would like to do.

I know there is a way to write the name of the running program to the log or an external file through the %sysget(SAS_EXECFILENAME) command so it may be possible to write a macro that writes the name of at least one of the open files into a textfile.

So that could work as long as you don´t have several files that you want to be opened automatically on startup.

Thanks for your help!

Trusted Advisor
Posts: 3,214

Re: Open last used programs on startup

Posted in reply to gusfryk01

On every type of object there is a "open recent".
When you use sas/base dms  there is "wave all" command and a registry entry. That is a SAS registry not the Windows registry.

The behavior looks more like a complete Desktop environment and is as total not well to get to a complete last state setting.
In a multi-user environment that would be not logical (impossible). You can never know what others in the time between could have changed.

---->-- ja karman --<-----
Valued Guide
Posts: 2,177

Re: Open last used programs on startup

Stored in sas somewhere is the "mru" most recently used file list. If it can be located then the top entry could be identified to  meet this need.

Ask a Question
Discussion stats
  • 7 replies
  • 646 views
  • 3 likes
  • 4 in conversation