BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Jade_SAS
Pyrite | Level 9

Hi all,

 

     I have a question about the SASUSER and SASDATA library, I read this link http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a002120511.htm

But I am still not sure how these two libraries used?

For me, I usually create a random library according to the syntax:  Libname OR '/home/Jade/OR';

I really do not know the advantage of SASUSER and SASDATA library and how they used.

 

Thanks,

Jade

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

SASUSER is mostly used by the SAS install. It is a bad idea to use it for data as that is one of the libraries that gets replaced by SAS during upgrades and installs.

 

USER is for those that have a need or want to reference data sets that persist from session to session with a single level name. The advantage is that not everything in the user the library is removed at the end of a session as in the WORK library. One disadvantage is that library can get very big if you have lots of temporary files that should have been written to WORK, which still exists and still is cleaned up at the end of the session. Another more subtle disadvantage is running other peoples code (such as from this forum), especially those with inconsistent use of the WORK library. If they reference something like:

data temp;

   set sashelp.class;

run;

proc print data=work.temp;

run;

Then if you have a user library the results may not match or even run because the first set gets written into USER but the print is looking in WORK. If you happen to have a different work.temp data set then the results may be quite confusing. Another potential problem is the default Format catalog can get large and temporary formats become permanent.

 

I am one of the odd ducks that do use a USER library because I work on multiple projects for multiple clients and never know when I will be interupted with a higher priority task. So I can switch tasks and my intermediate datasets don't disappear if I don't get back to the project for a few days.

I am very careful about running code from here with formats to assgn them to my work library so they do not overwrite any of my permanent formats in the User library. [I do keep the code for my formats to rebuild as needed though].

View solution in original post

6 REPLIES 6
Kurt_Bremser
Super User

SASDATA is not a standard SAS library, the standard SAS libraries (as speicified in the document you linked to) are WORK, USER, SASHELP and SASUSER.

WORK exists only for the duration of a SAS process; it is created when a SAS process starts, and deleted when the process terminates normally.

USER can be used as a permanent replacement for WORK; you have to create the directory and execute the libname for it.

SASUSER is used by SAS to store customizations of the SAS session; it is automatically created when a user first uses SAS. Depending on the configuration of SAS, SASUSER can me made writable for the user.

Jade_SAS
Pyrite | Level 9

Thanks! Normally how you use the User library?

Kurt_Bremser
Super User

To clarify: on UNIX systems, SASUSER is automatically created in the user's home directory when SAS is first used. The physical name of the directory is sasuser.v9X (X being the minor release number, so with SAS 9.4 it is sasuser.v94).

 

In a UNIX environment, I'd let SASUSER stay write-protected. Instead create a directory $HOME/mydata, and add

libname mydata '$HOME/mydata';

to the autoexec_usermods.sas file in the WorkspaceServer directory in your configuration tree. So every user has her/his private library.

ballardw
Super User

@Jade_SAS wrote:

    

For me, I usually create a random library according to the syntax:  Libname OR '/home/Jade/OR';

 


If by "random" you mean "a library to store data sets related to a specific project" then this is generally a recommended practice. If you put all of your data in one library it is not very long before you 1) have difficulty finding specific data sets 2) accidentally re-use data set names and overwrite other data you may have wanted to keep.

 

 

Jade_SAS
Pyrite | Level 9

Yes, I usually specify the library according to projects (I save different projects for different folder).

I never user SASuser and user library before and want to know the advantage to use it and how people use it.

ballardw
Super User

SASUSER is mostly used by the SAS install. It is a bad idea to use it for data as that is one of the libraries that gets replaced by SAS during upgrades and installs.

 

USER is for those that have a need or want to reference data sets that persist from session to session with a single level name. The advantage is that not everything in the user the library is removed at the end of a session as in the WORK library. One disadvantage is that library can get very big if you have lots of temporary files that should have been written to WORK, which still exists and still is cleaned up at the end of the session. Another more subtle disadvantage is running other peoples code (such as from this forum), especially those with inconsistent use of the WORK library. If they reference something like:

data temp;

   set sashelp.class;

run;

proc print data=work.temp;

run;

Then if you have a user library the results may not match or even run because the first set gets written into USER but the print is looking in WORK. If you happen to have a different work.temp data set then the results may be quite confusing. Another potential problem is the default Format catalog can get large and temporary formats become permanent.

 

I am one of the odd ducks that do use a USER library because I work on multiple projects for multiple clients and never know when I will be interupted with a higher priority task. So I can switch tasks and my intermediate datasets don't disappear if I don't get back to the project for a few days.

I am very careful about running code from here with formats to assgn them to my work library so they do not overwrite any of my permanent formats in the User library. [I do keep the code for my formats to rebuild as needed though].

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!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 6 replies
  • 9065 views
  • 0 likes
  • 3 in conversation