If you stick a file named
autoexec.sas in the directory where SAS is installed, it will run automatically when SAS starts up. By default, this place is
C:Program FilesSASHomeSASFoundation9.3. This has worked since at least SAS 8.2, probably before.
I like to use my Windows desktop as a temporary staging area, so I have my
autoexec.sas automatically assign a "DESKTOP" library with this code:
%let USERPROFILE=%sysget(USERPROFILE); libname desktop "&USERPROFILEDesktop";
So when SAS starts up, the library is assigned and my log says this:
NOTE: Copyright (c) 2002-2010 by SAS Institute Inc., Cary, NC, USA. NOTE: SAS (r) Proprietary Software 9.3 (TS1M2) Licensed to Microsoft Windows for x64 All Compatible Non-Plann, Site XXXXXXX. NOTE: This session is executing on the X64_7PRO platform. NOTE: Enhanced analytical products: SAS/STAT 12.1, SAS/ETS 12.1, SAS/OR 12.2, SAS/IML 12.1, SAS/QC 12.1 NOTE: SAS initialization used: real time 0.65 seconds cpu time 0.63 seconds NOTE: AUTOEXEC processing beginning; file is C:Program FilesSASHomeSASFoundation9.3autoexec.sas. NOTE: Libref DESKTOP was successfully assigned as follows: Engine: V9 Physical Name: C:UsersphilihpDesktop NOTE: AUTOEXEC processing completed.