Learning SAS? Welcome to the exclusive online community for all SAS learners.

How do I make the library and database created permanent and available during a new session?

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 13
Accepted Solution

How do I make the library and database created permanent and available during a new session?

With reference to YouTube video : https://youtu.be/B16AFyxlOD4 , I am posting my recent learning for the benefit of community users (My open question in the end) :

 

My question first question on this video was:

 

I tried to create a Library in the path "myfolders" created earlier. For some unknown reason, I am not able to create a library. When I tried the steps mentioned in the video, the Library name shows up in the list.

 

My code reads:

libname statclas "E:\SASUniversityEdition\myfolders\StatclassLibraries";

 

LOG shows:

Notes - NOTE: Library STATCLAS does not exist.

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;

55 56 libname statclas "E:\SASUniversityEdition\myfolders\StatclassLibraries";

NOTE: Library STATCLAS does not exist.

57 58 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 70

 

I was wondering, where was I going wrong?

 

Further, I found the resolution as follows:

 

From one of the videos I got a tip to enter the path without mistake.

 

For example the right way of entering path is: libname statclas "/folders/myfolders/librarykrn/statclass";

 

Here, the path given within quotes was created as follows:

1. Select Server files and folders on left pane,

2. Select myfolders ( Note: This myfolder is the same folder mapped to my Virtual machine). Within myfolders I have created subfolders Librarykrn/statclass already. Because it is created in myfolders, it is visible through Server files and folders section on left pane, after login.

3. Now select the folder statclass where we want to create the library. Right click on the folder to get the context menu.

4. Click on properties. Copy (Ctrl+C) the path.

5. Now on right pane, complete your program statement by inserting (Ctrl+V) the copied path within the quote.

6. Running this will successfully create a library.

 

At this moment, I am still figuring out ways to make this permanent though.

 

My question for the expert community members is, 

 

Instead of invoking libraries for each session (using libname statement), can't we make these libraries and databases permanently accessible for a user who created it?

 

Currently, at the start of a new session, I run my library creation snippet (created and saved by me) which has library creation code, and then the data I have imported to SASU is shown in the library (Refer video: https://youtu.be/7cfA6cE1D88).

 

I watched 2-3 videos on creating permanent libraries. Still not able to get through this hurdle.

 

Your help is appreciated.

 

For your information : I use SAS Release: 3.5 (Basic Edition) sofware with Oracle VM in Windows environment.


Accepted Solutions
Solution
‎08-19-2016 03:34 AM
Super User
Posts: 17,963

Re: How do I make the library and database created permanent and available during a new session?

Most of the answers to your (posted) questions can be found here:

 

https://support.sas.com/software/products/university-edition/faq/main.htm

 

If you search the Analytics U forum as well you'll find many of these questions asked and answered. 

https://communities.sas.com/t5/SAS-Analytics-U/bd-p/sas_analytics_u

 

Regarding a permanent library 

Open SAS UE 

Go to the top left corner and click the icon that looks like 3 lines

Edit Autoexec file. 

 

In this file add all the library, format and macro definitions that you want to exist at startup. 

Also, if you create a library by the GUI it has a check box to allow you to select enable at start up. 

 

PS Your running SAS 9.4TS1M3 via SAS Studio 3.5 on a VM. This is a similar set up to running SAS on a server. 

 

View solution in original post


All Replies
Solution
‎08-19-2016 03:34 AM
Super User
Posts: 17,963

Re: How do I make the library and database created permanent and available during a new session?

Most of the answers to your (posted) questions can be found here:

 

https://support.sas.com/software/products/university-edition/faq/main.htm

 

If you search the Analytics U forum as well you'll find many of these questions asked and answered. 

https://communities.sas.com/t5/SAS-Analytics-U/bd-p/sas_analytics_u

 

Regarding a permanent library 

Open SAS UE 

Go to the top left corner and click the icon that looks like 3 lines

Edit Autoexec file. 

 

In this file add all the library, format and macro definitions that you want to exist at startup. 

Also, if you create a library by the GUI it has a check box to allow you to select enable at start up. 

 

PS Your running SAS 9.4TS1M3 via SAS Studio 3.5 on a VM. This is a similar set up to running SAS on a server. 

 

Occasional Contributor
Posts: 13

Re: How do I make the library and database created permanent and available during a new session?

Thanks for the help. During my learning days, I tried using GUI for creating the table. I think table names were created and autoexec file also got updated. I was wondering how I am getting new libraries without even creating them. I have done the following changes:

 

libname XLDATDP '/folders/myfolders/library/DavisPecarExercises';
filename XLDATDP '/folders/myfolders/library/DavisPecarExercises/davidpecarex1_5.sas7bdat';

filename libref 'path of the database file';  

 

Have I used right syntax here?

 

Does editing autoexec file adversely affect my installation in any way?

 

Now I am happy to see my libraries and databases in it when I login into a new session.

 

THANKS!!

 

Kind regards, 

Niranjana

 

 

Super User
Posts: 17,963

Re: How do I make the library and database created permanent and available during a new session?

Your reference is incorrect. You don't use filenames to refer to SAS data sets. You can refer to the name directly in your code, the format is libname.datasetName. 

 

Proc print data=sashelp.class;
Run;

There are no adverse effects to using an autoexec. 

 

I'm not sure how you're trying to lean SAS, but the first e-course is free and I would strongly recommend completing that. See the bottom left hand corner of this page. Also, there are many useful videos listed here. 

http://support.sas.com/training/tutorial/

Occasional Contributor
Posts: 13

Re: How do I make the library and database created permanent and available during a new session?

 

I think I haven't understood this part of your instruction correctly :- 

 

"In this file add all the library, format and macro definitions that you want to exist at startup". 

 

Can you give me an example?

 

My previous attempts of creating library had created some code in the autoexec file. I deleted it and replaced with my new code. You must know I'm not an expert programmer here. After I added the above two lines of code in the autoexec file, I can see my library and file name after I login into a new session.

 

Appreciate your help Smiley Happy

Super User
Posts: 17,963

Re: How do I make the library and database created permanent and available during a new session?

You should only add the libname statement. Your filename statement is incorrect, you don't use a filename to reference a SAS dataset. The libname is what causes SAS to appear. 

 

Basically any code you add to the exec is run at startup, but it needs to be valid SAS code. 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 491 views
  • 2 likes
  • 2 in conversation