Help using Base SAS procedures

Change temporary work location within code

Accepted Solution Solved
Reply
Super Contributor
Posts: 398
Accepted Solution

Change temporary work location within code

Hello,

Is it possible to redirect my work folder to a different location while in sas using sas statements?  I'm using sas 9.3.

I tried

options work="c:\temp";

That returns this warning

WARNING 11-12: SAS option WORK is valid only at startup of the SAS System or startup of a SAS process. The SAS option is ignored.

I will need to run this on a linux server using SAS/Connect.  I'm doing a proc ginside with census block data that has over 600 million rows so for this one process I want to redirect the temp space.

Thank you


Accepted Solutions
Solution
‎06-22-2015 04:02 PM
Super Contributor
Posts: 398

Re: Change temporary work location within code

Thank you both for your replies.  I was able to figure it out using a Linux application that allowed me to use this command

$ sas -work /home/data/temp temp.sas

My task was to find a way to do it in sas then the lead told me to use this approach.

Thank you both for your help

View solution in original post


All Replies
Super User
Super User
Posts: 6,500

Re: Change temporary work location within code

How are you making the SAS/Connect session?  If you are using one of the SAS provided scripts then you can modify the command used to launch SAS on the remote machine to include -work option.

But if you are just worried about WORK datasets then just create permanent data sets instead.

Super Contributor
Posts: 398

Re: Change temporary work location within code

Hi Tom,

I'm connecting using the signon statement.

When proc giniside runs it creates a temp table that is very large.  I want it to put that in a location where I have enough space for it to get as big as it needs.

Thank you

Super User
Super User
Posts: 6,500

Re: Change temporary work location within code

I suspect that you want to change the UTILLOC option and not the WORK option.  As I said before you can control where the datasets are made by changing the name you use for them.  But the placement of intermediate files that a proc might create are controlled by the UTILLOC option.

If you are using a script with the SIGNON command then you can modify the script.  For example the default script for connecting via TCP to a Unix host includes this line.

   type 'sas -dmr -comamid tcp -noterminal ';

You can just make a modified version and use it in the SIGNON.

If you are using the SASCMD= option on the SIGNON then perhaps you can modify that command to include the UTILLOC option.

But if you are connecting to some SAS spawner then I think you would need to make changes there, which would be harder to do by a single user.  Perhaps the admin can create a separate service that you can connect to for these types of jobs?

Solution
‎06-22-2015 04:02 PM
Super Contributor
Posts: 398

Re: Change temporary work location within code

Thank you both for your replies.  I was able to figure it out using a Linux application that allowed me to use this command

$ sas -work /home/data/temp temp.sas

My task was to find a way to do it in sas then the lead told me to use this approach.

Thank you both for your help

Super User
Posts: 5,084

Re: Change temporary work location within code

jerry,

You have certain complications here ... the SAS/Connect situation, and working storage as a procedure executes rather than storing a one-level data set name.  So you will need to test this to see if it actually works for you.

The general idea is that you set up a library yourself:

libname mystuff 'path to folder';

At any point in the program, you can specify:

options user=mystuff;

Automatically from that point forward, all single-level data set names get stored in MYSTUFF, instead of in WORK.  Later on, you can restore the original conditions:

options user=WORK;

The MYSTUFF folder will not get cleaned out automatically at the end of your program ...  you will need to manage that yourself.

Good luck.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 410 views
  • 6 likes
  • 3 in conversation