BookmarkSubscribeRSS Feed
makset
Obsidian | Level 7

I have sas 9.4 installed on drive C and all data on drive F. How to make sas not create temporary files on drive C only on F. Drive F is much faster.

 

Best regards and thank you in advance for your help.

3 REPLIES 3
Ksharp
Super User
libname x v9 'F:\temp';
options user=x ;

But this code only work for temp dataset ,not util dataset generated by stat proc like PROC GLM
RichardDeVen
Barite | Level 11

Change the location of the WORK libref.

 

The location of the WORK libref is specified in the standard installation location 

  • "C:\Program Files\SASHome\SASFoundation\9.4\nls\en\sasv9.cfg"

in line line 

  • -WORK "!TEMP\SAS Temporary Files"

You can specify your own folder by a couple of ways

  • edit your system wide default config.sas
  • create a custom config.sas in your userhome or startup folder
  • specify a custom config.sas in the SAS startup command
  • change the environment variable TEMP in the SAS startup command
    • change is specific to only the SAS session process started

Example:

Change TEMP

 

The SAS icon on my desktop taskbar has property target as the command 

"C:\Program Files\SASHome\SASFoundation\9.4\sas.exe" -CONFIG "C:\Program Files\SASHome\SASFoundation\9.4\nls\en\sasv9.cfg"

Edit the target so that the environment variable TEMP is changed for the SAS session that is launched.

"C:\Program Files\SASHome\SASFoundation\9.4\sas.exe" -CONFIG "C:\Program Files\SASHome\SASFoundation\9.4\nls\en\sasv9.cfg" -set TEMP D:\TEMP

Starting SAS from the icon will now have a different folder for WORK

2    libname WORK list;
NOTE: Libref=   WORK
      Scope=    Kernel
      Engine=   V9
      Access=   TEMP
      Physical Name= D:\TEMP\SAS Temporary Files\_TD3944_HELIUM_
      Filename= D:\TEMP\SAS Temporary Files\_TD3944_HELIUM_
...

 

If you are presuming WORK means the default library when only the member name is coded (one-level SAS data set name), then you can use the USER option to specify which library to use in such cases.

 

Example:

libname FASTER 'F:\TEMP';
options USER=FASTER;

data class;
  set sashelp.class;
run;
----- LOG -----
5 options USER=FASTER; 6 7 data class; <------------- one-level name 8 set sashelp.class; 9 run; NOTE: There were 19 observations read from the data set SASHELP.CLASS. NOTE: The data set FASTER.CLASS has 19 observations and 5 variables. <---- USER= adjusted one-level name NOTE: DATA statement used (Total process time): real time 0.02 seconds cpu time 0.01 seconds
jimbarbour
Meteorite | Level 14

All of the advice that you have received so far is good advice.

 

Sometimes, however, depending on your company's policies, certain things like editing config files aren't always possible.

 

One other option is to run your program in "batch" mode (instead of interactive).  The command varies by environment (Windows, Unix, Mainframe, etc.).  Here's an example from Windows where I've created a little .bat file which, when double-clicked, launches my SAS job in batch mode with all the parameters that I have specified:

set env=production
::set env=development

sas -set environment %env% -set lPwd_PASSWORD XXXXXXXX -memsize 32G -work N:\Work -logparm "rollover=session write=immediate" -log C:\Users\XXXXXXXX\Documents\SAS\Pgm\Test\Hive_Grid\logs\Join_Members-tblMMR0323_Restated_MONO_#Y-#m-#d_#H-#M-#s_#p.log -sysin C:\Users\XXXXXXXX\Documents\SAS\Pgm\Test\Hive_Grid\Join_Members-tblMMR0323_Restated_MONO.sas -nostatuswin -noterminal -nosplash -noicon
pause

Some of the parameters I'm using in the above example:

  • Work.  I'm assigning Work to a drive that, in this case, has more space because I have some big files to work with.
  • Memsize:  Again, I'm using big files, so I'm increasing my memory allocation.
  • Logparm:  I'm using "immediate" which means that the log is written too as soon as SAS has log output.  Otherwise SAS will buffer the writing to the log.  When buffered, you can lose part of the log if the job crashes, and, if you have long running steps, it can take forever for enough log data to get into the buffer to the point where SAS actually writes it to the log.  Caution:  "Immediate" is less efficient.  "Immediate" is a great option for debugging, but once a job is stable, "Buffered" is typically going to give best performance.
  • Log:  I'm using a series of log directives which tell SAS how to dynamically name the log file.  Here, I'm adding a system generated data time stamp and the Process ID to the name of the log file.

You don't have to code all of these parameters, Logparm for example is not essential; this is just an example.

 

All that to say, sometimes it's better to submit via batch when you need to have a little more control over parameters that must be set at start up.

 

Jim

 

 

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
  • 3 replies
  • 4847 views
  • 4 likes
  • 4 in conversation