How to Trigger Autoexec ?

Reply
Regular Contributor
Posts: 173

How to Trigger Autoexec ?

Hello Everyone,

I have created an autoexec file in the same directory when I store my signon_to_sasgrid1.sas.  When I launch a new SAS session, i have to manually open the signon_to_sasgrid1.sas to enter my log in credentials.  How do I trigger the autoexec to run and open signon_to_sasgrid1.sas automatically when I launch a new SAS session?

Thank you!

Super Contributor
Posts: 644

Re: How to Trigger Autoexec ?

Add the line to your autoexec.sas

%Include "signon_to_sasgrid1.sas" ;

You may have to fully reference the file path

Richard

Regular Contributor
Posts: 173

Re: How to Trigger Autoexec ?

Posted in reply to RichardinOz

Thank you RichardinOz.

I added the %include "signon_to_sasgrid1.sas" to my autoexecs.sas.   When I launch SAS I am still not automatically prompted to enter my login credentials.  So what I do is I run autoexec.sas and it runs signon_to_sasgrid1 which prompts me to enter my login credentails.  What am I missing?

Thank you!

Super User
Super User
Posts: 7,074

Re: How to Trigger Autoexec ?

How are you running SAS?  If you open a command windows and move to the directory with the program and launch SAS by issuing a command from the command line it should find the autoexec.sas file in the current directory.  But with Windows the style is to launch SAS by clicking on an ICON. In that mode how does the icon know what directory to look for the autoexec file?  Or it is even possible that you have already specified some other location for the autoexec file in the command line options or the config file that you are using to start SAS.

Trusted Advisor
Posts: 3,215

Re: How to Trigger Autoexec ?

The current dir can be set by using SAS(R) 9.3 Companion for Windows SASInitialfolder.  There are interactions that are giving not a good feeling as of this note: 51194 - When you use SASINITIALFOLDER options in a SAS® program that resides on the network, you mig... . The Unc namings are not reliable and causing effects.


Normally it is a bad idea coding plain userid and password in some code. There are better approaches to have them not hard-coded.
Some of those methods are requiring preparations in an autoexec. I would expect IT department delivering that as a service to you.     
I hope you are not working with user=kevin password=qwerty123   with a yellow-stickynote attached at your desk.

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

Re: How to Trigger Autoexec ?

How do you launch your first SAS session?

Is it SAS Enterprise Guide, "fat client" SAS (display manager), or by double clicking an icon in windows?

Each of these cause different challenges to achieve what you seek.

If it is from a windows icon,  check the "start in" folder defined for the icon.

that is where your first SAS session would look for autoexec by default. Of course the launch command could redirect the -autoexec to somewhere else for some other file.

The -sasInitialFolder directs a SAS session dialog box where to start looking for programs.

Kevin,

none of your examples show a path on the %include - it is one way to direct that file include

In a sas session launched by SAS Enterprise Guide, many of the familiar assumptions about our (fat client) SAS session  are very "broken". The major issue is for those who share a SAS server. Probably paths and permissions are  quite different  between the client interface environment and the server-side sas session.

Regular Contributor
Posts: 173

Re: How to Trigger Autoexec ?

Thank you guys for your replies.

I launch SAS from a Windows icon.  This is the first line in my autoexec:

%include "C:\My Documents\My SAS Files(32)\9.3\signon_to_sasgrid1.sas"

If I open the autoexec.sas and click run, it starts signon_to_sasgrid1.sas and prompts me to log in.  But I can't get autoexec to start automatically.  Where is the "start in" folder?

Thank you guys again!

Super User
Posts: 5,434

Re: How to Trigger Autoexec ?

Open the properties for your Windows icon/shortcut. It has a Start in field.

Another option is to an -autoexec "search path to your autoexec" to your SAS command ("Target" in the properties window).

Data never sleeps
Trusted Advisor
Posts: 3,215

Re: How to Trigger Autoexec ?

KevinC  See the remark of Tom as you are pushing on an icon  thee is no sasinitialfolder logical defined it can be everywhere the installer gay has decided.

Whe you create your own shortcut you can do that. ....

---->-- ja karman --<-----
Super User
Super User
Posts: 7,074

Re: How to Trigger Autoexec ?

You could also just put the autoexec.sas file into whatever folder the ICON is using.

Start SAS.

Put your autoexec code into the program editor.

Issue the command file 'autoexec.sas' from the command line.

Ask a Question
Discussion stats
  • 9 replies
  • 826 views
  • 0 likes
  • 6 in conversation