BookmarkSubscribeRSS Feed
er_awasthi
Calcite | Level 5
What is SAS user LIbrary ? Is it the SAS files that is created to store permamanent datasets ? If no then how are these created and what is their functions ?

I google it but i couldn't get any specific answer ??

The SAS certifications book says ""Sasuser is a permanent library that contains SAS files in the Profile catalog that store your personal settings. This is also a convenient place to store your own files. ""

How are they created ???
5 REPLIES 5
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Essentially your SAS WORK allocation starts out as your SAS user library, unless you choose to override the destination with a -WORK at SAS invocation or in your CONFIG file. The SASUSER option permits you to change the "default" location for your WORK/USER dataset and SAS catalog location (such as your generated formats or possibly ODS modifications).

Here is a reference paper from the SAS support http://support.sas.com/ website - SAS Enterprise Guide is mentioned however the content is applicable to SAS Base, as discussed. Also, the various SAS companion guides have discussion on SASUSER, if you were to search from the SAS website or using Google.

Scott Barry
SBBWorks, Inc.

http://support.sas.com/techsup/technote/ts759.pdf
er_awasthi
Calcite | Level 5
Thanx scott The document is very Informative .

But i still have one question

Is SAS User file is system file Or a user can create it ? How can a developer access his SAS user files if we wants to change his seetings ?
File which i create to store permamennt datasets and SAS User library are two diffrent files ?

Right now Im confused in between SAS Files which are created by SAS user to store his dataset and SAS user Library ? are they same ?

Thanx
Manish Awasthi
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
As documented, the user's "sandbox" for their SAS session starts out as a temporary WORK libref -- or it can be overridden at invocation with the -WORK option. And during the session the following statement overrides it yet again, as required:

SAS OPTIONS SASUSER=;

Any of these driver/directory locations can be a permanent location where the user stores SAS files and/or catalog objects, as needed, for their SAS application.

Scott Barry
SBBWorks, Inc.
Cynthia_sas
SAS Super FREQ
Hi:
Let's say that I know a person who uses sas. His name is Fred. Fred is a SAS user, but instead of confusing him with the concept of a SASUSER library, I'm going to call Fred a SAS programmer.

When Fred starts using SAS at his company, he gets a new computer. SAS is either installed on his physical computer or he uses SAS on his company's network, accessing SAS via SAS Enterprise Guide or via other means (TelNet, batch jobs, TSO/ISPF, Roscoe, Wylbur, etc)

A SAS library is just a collection of computer files (SAS data and other files) that are stored in a way that's specific to each operating system. But, no matter what the PHYSICAL storage mechanism is, the LOGICAL concept of a library is the same. So, let me talk about SAS libraries. As the documentation says, a SAS library is a collection of SAS files, mostly SAS datasets, but a SAS library could also contain SAS catalogs and other types of proprietary SAS files. I know, you think of a library as a huge building with a lot of shelves and a lot of books. But that's almost too big for me, so, to keep things simple, let's use a different comparison.

Think of a file cabinet drawer. One drawer can hold multiple file folders. Every time you start a new SAS session, the concept of a SAS library is like a file cabinet drawer. When you start your SAS session, you have 2 file drawers to start -- the WORK file drawer (or SAS library) and the SASUSER file drawer (or SAS library). The WORK library is empty when you start your SAS session -- it's where your temporary work SAS data sets (the file folders) will be stored while your session is active. The SASUSER file drawer (or SAS library) has a few SAS files already stored in it the first time -- your SASUSER.PROFILE file and a couple of other files.

When your SAS session is over, the data cleaners sneak in the back door and throw out EVERYTHING in your WORK file drawer (or SAS library), but they're not allowed to throw out what's in your SASUSER file drawer (or SAS library). So, the SASUSER library is a convenient place for you to store your file folders (or SAS datasets) if you need for the data to be permanently stored.

But while your SAS session is active, you can when you start out, access the WORK and SASUSER file drawers (with programming statements or point and click methods) in order to access the data that's in the file drawers (or SAS library). Now, Fred probably won't have any data in either the WORK or SASUSER libraries when he starts out, so he needs to go talk to the data managers to find out where his data is and how to point to it.

Well, those data managers at the new company have put the production data onto the Q drive at the company. They know that some programmers need to get the Accounting data, some programmers need to get the Human Resources data and some programmers need to get the Vendor data. And, they also know that any programmer who needs to access the production data with SAS can point to it with a LIBNAME statement. They give Fred the correct LIBNAME statement to access his data. So, let's assume they have a Windows system and on a network drive they have the following folder structure and SAS data files (as viewed with Windows Explorer):
[pre]
q:\HR\active\employees.sas7bdat
q:\HR\active\dependents.sas7bdat
q:\HR\active\jobcodes.sas7bdat
q:\HR\active\benefits.sas7bdat

q:\HR\retired\retirees.sas7bdat
q:\HR\retired\benefits.sas7bdat

q:\Account\purchaseorder.sas7bdat
q:\Account\vendors.sas7bdat
[/pre]

Fred is going to be working with the Human Resources or HR data. He needs to make a "virtual" file drawer in his SAS session that points to the HR data on the Q drive. So he uses this LIBNAME statement:
[pre]
libname Active_HR 'q:\HR\active';
[/pre]

And, now, he's given his file drawer (or SAS library) a label (or LIBREF) of "Active_HR" and to access the SAS data files in Active_HR, he would use a 2-level name in his programming code:
[pre]
Active_HR.employees
Active_HR.dependents
Active_HR.benefits
Active_HR.jobcodes
[/pre]

As long as Fred's SAS session is active, he will be able to get inside his Active_HR file drawer or SAS library to access his data. Now, the SASUSER and the WORK libraries or file drawers are automatically created and pointed to by SAS whenever Fred starts up a SAS session or runs a SAS program -- so he doesn't need a LIBNAME statement for those 2 SAS libraries. SAS takes care of that for him. But, every time Fred wants to access the Human Resources data, he will have to point to those SAS files with a LIBNAME statement or otherwise use a point and click method to point to the Human Resources files.

Now, let's say that Fred doesn't want to do anything with the "real" Human Resources data because he's still learning SAS. So, he either asks the data managers to make him a copy of the ACTIVE_HR.JOBCODES file or he makes a copy -- where's he going to put that working copy so he can test out his SAS skills??? A good place to put a copy of the SAS data file would be in his SASUSER file drawer (or SAS library). Some other programmer at the company gives Fred this SAS program:
[pre]
libname active_hr 'q:\HR\active';

proc sort data=active_hr.jobcodes out=sasuser.jobcodes;
by jobcode;
run;

proc print data=sasuser.jobcodes;
title 'For Fred';
run;
[/pre]

Now, the LIBNAME statement is pointing to the production data. Then the proc sort step is sorting the Active_HR.JOBCODES data and making a copy in Fred's file drawer (or SAS library) labelled SASUSER -- now, when Fred wants to experiment or try out his SAS programming skills, he has a copy of the SAS data set to play with. The production SAS files are always going to stay on the company Q drive on the network, but now, Fred can write programs using SASUSER.JOBCODES and he will not impact the production data.

From this example, Fred (the SAS user or SAS programmer) has created some data in his SASUSER library. The SASUSER library is a physical location on a disk drive -- either on Fred's computer or on a network location -- each time Fred starts up SAS, there's a configuration file that tells SAS where Fred's SASUSER library is located.

Eventually, Fred will probably not use his SASUSER library very much at all, because he'll be comfortable with the concept of the SAS libraries and data files. Every once in a while, Fred will get to the end of a day of hard programming and he'll want to save some of his work so he can come back to it again the next morning -- then he might store some of his files in his personal SASUSER library, so that he can find them quickly first thing in the morning.

Once in a while, Fred might create some file or use some SAS process that writes files to the SASUSER library by default. This is a good thing when Fred is starting out. But usually, when Fred works, he will use the Active_HR library to access the production data and do his work.

Whew! long explanation -- probably too long, but I hope it helps clear up your confusion.

cynthia
er_awasthi
Calcite | Level 5
Thanx Cythia

The explanation is fabulous and awesome . U had given explanation in such a way that a Layman can undertand Thanx a ton for spending ur valuable time for clearing my doubt.

Thanku Cynthia and Scott

Thanx
Manish

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