Help using Base SAS procedures

open a file on startup

Posts: 56

open a file on startup

every time I open SAS i have to press 'Ctrl+s' and then browse to the file with my sas code file, press open and it pops up in the editor window.

My question is.

Is there a way to do this auto, like the default start-up file?

Super User
Posts: 13,583

Re: open a file on startup

Is it the same file every time? Or the last one used? Do you want it to run on open or not?

Also you may want to try going to Tools> Options > Preferences > General and make sure that the 'Recently used file list' box is checked. And set a number in the box below immediately below for how many files you want to have available (I use 25). Then clicking on the File menu will bring up the recently used list where you can select a file, which should at least save time.

Super User
Posts: 3,926

Re: open a file on startup

Try creating an program that will automatically run when SAS starts and in this program have the statement:

DM 'include "" ';

Valued Guide
Posts: 2,191

Re: open a file on startup

there is an option you can specify before SAS starts

-initcmd  'wedit "your sas program path\" '

specify it

on the command line


in a config file


in user environment variable  sas_options

For simplicity, I start SAS with no options, but specify that the folder in which it starts is my preferred place and there I create an empty sasv9.cfg file into which I would place that -initcmd option

Super User
Posts: 10,787

Re: open a file on startup

You can directly double-click this file ,and SAS will open it for you defaultly.

Valued Guide
Posts: 2,191

Re: open a file on startup


are you running SAS in Win7?

I run SAS on winVista32 which still suffers from the "old problem" caused by microsoft ole automation server. That handles the launching of registered file types and sets the "current folder" where SAS will start, as windows\system32!  I cannot normally write there, and I support legacy code which expects the current folder to be "writeable" (for example, to write a .log or .altlog file).

If you are running SAS on win7, with your proposal "double-click this file ,and SAS will open it for you defaultly", does the SAS session start in the folder of "" or in the windows\system32 folder or somewhere else?


Super User
Posts: 10,787

Re: open a file on startup


My SAS9.2 is under WinXP ,WinXP is too old I know. I can open the sas code easily.

Super Contributor
Posts: 273

Re: open a file on startup


I can test it on my pc W7 32b  with 9.3.0 and

if i modify the config file in nls\en to neutralize both

the   -set MYSASFILES           and the eventual  -SASINITIALFOLDER

when i go starting from D:\tabsas

and rightclic  on the item "open with sas 9.3"    (sorry the double clic is acting with the sas universal viewer  1.2)

the  program is opening in the enhanced pgm editor

indicating down at the limit  the directory     D:\tabsas\


only seeing  File /  opening a program  shows  that it is  located at  ....My SAS Files\9.3\   d:\... in my case


only seeing  File /save as show a location  at d:\tabsas\

in the reverse order  yet only seeing  but not acting on a button

File /  the save    shows d:\tabsas\

and then File /  opening a sas program  shows  d:\tabsas\

a discovery for me !      so the sequence you are opening items of the File Menu have effects!!!!


Ask a Question
Discussion stats
  • 7 replies
  • 6 in conversation