User defined libraries creations in SAS

Ratings:
(4)
Views:0
Banner-Img
  • Share this blog:

User-defined libraries creations:

Lib name statement:

It can be used to create user defined libraries. Libname statements global statement. It is stored outside the data set block and procedure block. User can create 2 types of libraries

  1. Independent
  2. Dependent

Independent libraries:

If we store any data set in required library, it is available in that library only. This type of library is called independent library. It is temporary and permanent.  

Dependent libraries:

If we store any data set in required library, its default stores in another library. This is called dependent library. It is temporary and permanent.  

Independent library creation:

Temporary:

       Temporary library statement is created bt using libname statement. Libraries names you can give upto 8 characters Syntax: Libname<library name (or) reference> <engine>’<path>’;

At TekSlate, we offer resources that help you in learning various IT courses. We avail both written material and demo video tutorials. To gain in-depth knowledge and be on par with practical experience, then explore SAS Training.

Engine: It stores the data in SAS data set in different formats. These formats defaults takes based on versions(technologies) Ex: Lib name clinical ‘d;\gun’; Data clinical . demo; Input pid age color $ height; Cards; 100 23 white 5.6 101 34 black  4.5 102  45 white 4.5 ; Proc print data =clinical demo .demo; Run; Note: Difference between work to user defined library. Work is permanent but it stores data set temporary for SAS version. User defined temporary library, libraries also temporary and data sets also temp for SAS version.  

Permanent: menu drive process:

Name – fill with library name -> engine(default)-> click on enable to start up -> browse(to specific pc path)-> click ok.  

Dependent library creation:

Temporary:

Dependent library creation work on pc path Ex: Lib name Uma ‘d:\one’; Libname Kumar(Uma); Libname Kiran(Kumar); /* or */ Libname Uma ’d:\one’; Libname Kumar ’d:\one’; Libname Kiran ’d:\one’; Ex: /* storage */ Data Uma .demo; Input pid age; Cards; 100 56 101 89 109 23 ; Proc print data= Uma. Demo; Run;   Permanent: If we want ot create a dependent libraries permanently we will click on enable to startup and assign same path for required libraries. Use with browse button.  

Deletion of the libraries from the SAS environment:

  1. Menu drive
  2. Coding

Note: Temporary libraries can be created by using menu drive and coding and the same way we can delete menu drive process and coding also. Permanent library can be created by using menu drive. That’s way it can delete by menu drive only.

The syntax for library deletion:

      Libname<library reference or name> clear; Capture                                        

To read the data from one data set to another data set:

   Syntax: Data<new data set name>; Set<existed dataname>; Run; Ex: Data emp; Input eid salary sale; Cards; 1234  2300  678 1245  4500  456 1256  8900  567 1456  3000  400 1890  4500  300 1235  7800  580 1267  5000  380 ; Data emp1; Set emp; Run; Proc print  data =emp1; Run;  

Data manipulation:

      /* To store modification in same variable and new data set */ Data emp2; Set emp; Salary =salary +2000; Run; Proc print data =emp2; Run; /* To store modification in new variable and new data set */ Data emp3; Set emp; nSalary =salary +2000; Run; Proc print data =emp2; Run; /* To store modification in new variable and existed data set */ Data emp; Set emp; nSalary =salary +2000; Run; Proc print data =emp2; Run; If we want to do any work based on condition we will use conditional statement. Conditional statement are working based on operators.

You liked the article?

Like : 0

Vote for difficulty

Current difficulty (Avg): Medium

Recommended Courses

1/15

About Author
Authorlogo
Name
TekSlate
Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.


Stay Updated


Get stories of change makers and innovators from the startup ecosystem in your inbox