Library

How To Create A Library In Sas Tutorials: Sas Libraries, Create A Library (1 Of 4)

This SAS software tutorial describes what SAS libraries are used for, and how to create and access your own libraries.
Intro to the SAS Environment Working With Data Toggle Dropdown Exploring Data Toggle Dropdown Analyzing Data Toggle Dropdown Using SAS OnDemand for Academics Toggle Dropdown

Our tutorials reference a dataset called “sample” in many examples. If you”d like to download the sample dataset to work through the examples, choose one of the files below:

A SAS lisbdnet.com is a folder located on a user's disk drive or on the internet that is specially designated for use by SAS. SAS libraries allow users to safely store things like data sets and user-defined formats so that they can be accessed without having to reload or re-read them from an external file every time SAS is started.

Đang xem: How to create a library in sas

If the data you want to work with is already a SAS dataset stored somewhere on your computer, then all you need to do to start working with your data is assign a lisbdnet.com name to the location of the dataset. If it is stored as a file other than SAS (Excel, SPSS, text, etc.) then you’ll need to help SAS read it with one of the methods described in the next sections of this tutorial. Alternatively, you can create your own data in SAS, which is also covered below.

One or many datasets can be assigned to the same lisbdnet.com. A lisbdnet.com is assigned a location with a LIBNAME statement in SAS. A LIBNAME statement is one of those global statements that we mentioned in Section 1 that does not occur in a data step or a proc step. The format of the LIBNAME statement is:

LIBNAME libref 'Folder path name here';Here the first word (LIBNAME) is the SAS keyword that tells it to create a lisbdnet.com. The second word (libref) is what you name the lisbdnet.com. It must be eight or less characters and start with a letter. Finally, the text in quotes is what path name you tell SAS to assign the lisbdnet.com to. (This folder must already exist on your computer.) Here is an example LIBNAME statement that creates the lisbdnet.com named practice and assigns it to a folder in the directory ‘C:UsersResearchThesis.’

See also  Illinois Prairie District Library, Illinois Prairie District Public Library

LIBNAME practice 'C:UsersResearchThesis';Most SAS users put their LIBNAME statements at the beginning of the program, but you can put a LIBNAME statement anywhere in the program as long as it comes before you reference a file in that location. You will get an error message if you try to refer to a dataset that has not yet been pointed to in a LIBNAME statement. Once a lisbdnet.com has been assigned to a location with a SAS dataset, the dataset can be referred to in statements using two parts:

libref.SAS-dataset-nameThe first part of the name (before the period) is the dataset’s lisbdnet.com assignment. The second part of the name (after the period) is the dataset’s name. For example, if we have a dataset named sample stored in the folder ‘C:UsersResearchThesis’, which we’ve told SAS is the location of our lisbdnet.com called practice, then we refer to that dataset as

practice.sampleWhen you end your SAS session, any libraries that you’ve defined will be lost. This just means that when you restart SAS, you will need reload the lisbdnet.com again in order to access its contents.

SAS has a built-in temporary lisbdnet.com called Work. The Work lisbdnet.com is a place to store data you are working on in your current session. Because the Work lisbdnet.com is temporary, you will lose any datasets you created and stored in the Work lisbdnet.com when you close out of your SAS session.

You do not have to declare the Work lisbdnet.com with a LIBNAME statement because it is automatically created when you open SAS. Furthermore, you do not have to include it as the libref when you reference a dataset – a dataset named without a libref is assumed to be in the Work lisbdnet.com.

See also  New Baltimore Mi Library 36480 Main St New Baltimore, Mi Libraries

A data step that starts with this line:

DATA work.StatsRule;is the same as a data step that starts with this line:

DATA StatsRule;Both will create a dataset called StatsRule in the work lisbdnet.com. The Work lisbdnet.com can be extremely useful when you want to manipulate a dataset with multiple data steps and you don’t necessarily want to save the datasets resulting from the interim steps.

The Work lisbdnet.com can also be helpful if you want to work on your stored dataset, but you are nervous about manipulating the original file – just copy the dataset into the Work lisbdnet.com and you can manipulate it there. Copying a dataset into the Work lisbdnet.com is easy:

DATA test; SET practice.sample;RUN;The program above copies the dataset sample (which is located in the SAS lisbdnet.com called practice) into a temporary dataset called test (which is located in the Work lisbdnet.com). Now you can try out some manipulations on your temporary dataset called test without altering your original dataset. Once you are sure you’ve got it right, you can save the dataset back into your permanent lisbdnet.com.

Xem thêm: The Hal Lindsey Youtube 2016, The Hal Lindsey Report October 14, 2018

SAS University Edition and SAS OnDemand for Academics both use the SAS Studio interface. It is possible to use SAS libraries in both of these programs, but because these programs run on “virtual machines”, the appropriate file paths for your libraries will be different than if you were using “desktop” SAS.

If you are using SAS University Edition, your lisbdnet.com file paths will always begin with: /folders/myfolders/

See also  About: George F Smith Library Of The Health Sciences, George F Smith Library Of The Health Sciences

If you are using SAS OnDemand for Academics, your lisbdnet.com file paths will always begin with: /home/your-user-name/(where your-user-name will be replaced with the user name associated with your SAS account)

These programs will not recognize file paths to locations on your computer.

Fortunately, both SAS University Edition and SAS OnDemand for Academics make it easy to set up libraries in your account without necessarily needing to write and execute a LIBNAME declaration. Within the Libraries navigation pane, click on the small filing cabinet icon under “Libraries”.

*

This will open the New lisbdnet.com window:

*

A Name: Create a name for the new lisbdnet.com.

B Path: The directory where the lisbdnet.com is located, equivalent to the file path specified in a normal LIBNAME statement. Click the Browse button to select the directory to use for this lisbdnet.com.

Xem thêm: Best Thai Massage Houston ), Best Thai Massage For Men In Houston, Tx

C Re-create this lisbdnet.com at start-up: Optional setting for SAS to “remember” this lisbdnet.com definition every time you use SAS University Edition. (This means that you wouldn't have to re-run the LIBNAME syntax or re-do the New lisbdnet.com steps the next time you launch SAS University Edition.) For most users, this is a nice convenience, especially if you will be using the same lisbdnet.com over many sessions.

See more articles in category: Library

Leave a Reply

Back to top button