BookmarkSubscribeRSS Feed
Das123
Calcite | Level 5

Hello,

I am using SAS 9.2

 

Location of my default temporary ‘work’ library

%put %sysfunc(getoption(work));

C:\Users\user1\AppData\Local\Temp\SAS Temporary Files\_TD6864_UPLCI087142_

 

But when I run the following code

data temp.set1;

set1=2;

run;

 

and then find location of this ‘TEMP’ library using the following command

 

%put %sysfunc(pathname(temp));

C:\Users\user1\AppData\Local\Temp

 

Question: I am not sure that an automatic libname “temp” exists in SAS. And data stored here are permanent. I could not find this in any SAS documentation.  Can you please explain.

2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

No, there is no libname called temp in the default SAS install.  Work is the temporary folder.  The idea is that in your programs - (or if you work on a project or server environment these might be setup for you) - create the references which you use to store you data, work is removed at the end of the session:

libname yourlib "path-to-folder";

 

So path-to-folder is a folder on your local machine, or network where to store data permanently.

FreelanceReinh
Jade | Level 19

Thank you for posting this interesting question. Searching for the answer I discovered this page of the online help (for SAS under Windows):

https://support.sas.com/documentation/cdl/en/hostwin/63285/HTML/default/usedatalibs.htm#useenvvar

 

Quote:

---------------------

When you use a libref in a SAS statement, SAS resolves libref assignments in this order:

  1. a libref assigned by a LIBNAME statement, a LIBNAME function, or by using the New Library dialog box, with the last assignment taking precedence

  2. a libref assigned by a SAS environment variable

  3. a libref assigned by a Windows environment variable.

---------------------

 

In your case I guess that a Windows environment variable TEMP exists (this is the case on my computer, too) and points to the path you've mentioned.

 

You can quickly list the Windows environment variables and their values in the SAS log by submitting the following code:

 

filename ttt pipe 'set';
data _null_;
infile ttt lrecl=5000;
input;
put _infile_;
run;

 

 

A list of the SAS environment variables (see item 2 above) and their values can be obtained as follows:

 

%put %sysfunc(getoption(set));

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 2 replies
  • 853 views
  • 1 like
  • 3 in conversation