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

Libname statement in SAS Studio

Reply
New Contributor
Posts: 3

Libname statement in SAS Studio

I have 20 years of experience with SAS, but with SAS Studio, I'm having difficulty even writing a libname statement.

 

How do I do this simple thing in SAS Studio and find a data ABC in it?

 

libname here "C:/temp";

data here.ABC;

x=1;

run;

 

 

 

Super User
Posts: 3,250

Re: Libname statement in SAS Studio

New Contributor
Posts: 3

Re: Libname statement in SAS Studio

I created the folder and I do see data in it while looking at them within SAS. BUT when I open the actual folder on my PC, I don't see the permanent datasets. Could you advise?
Super User
Posts: 3,250

Re: Libname statement in SAS Studio

What VM software are you using? If this is configured correctly I think you need to use something like:

 

/folders/myshortcuts/folder-name in your LIBNAME statement not a drive letter.

 

SAS Employee
Posts: 147

Re: Libname statement in SAS Studio

An easy way to assign a lifref in SAS Studio (regardless of whether you're using University Edition, regular SAS, or whatever) is to right click on the folder in the files & folders navigation then select create then library.  It takes care of getting the path correct.  You can also copy the path from there to use in a LIBNAME statement if you'd really prefer to write your own.   If you do it that way, can you see the permanent data sets you've created?

Super User
Posts: 19,770

Re: Libname statement in SAS Studio

The difficulty here is you're working on a Virtual machine that has to connect to your computer via mapped directories. Its similar to consider working with SAS on a server and the VM is the server and your browser is the connection, but to connect to the server you need to do some extra things.

SAS Super FREQ
Posts: 8,862

Re: Libname statement in SAS Studio

Hi:
If you are using SAS Studio through the SAS University Edition or the Amazon AWS or through SAS OnDemand for Academics, then SAS has NO visibility of your C: drive.

For example, if you are using SAS Studio with SAS University Edition in a Virtual Machine, you might have a physical shared folder location on your c: drive, for example, named:
c:\SASUniversityEdition\myfolders\mystuff
BUT, you can't use Windows path locations with the University Edition because the Virtual Machine is a Unix-based machine. So, instead, if you define your shared folder location in your Virtual Machine properties, then the correct LIBNAME for the above location would be:
libname stuff '/folders/myfolders/mystuff';

Notice how the "high level" part of the path 1) uses Unix slashes and 2) references the shared folder high-level location as: /folders/myfolders.

If you are using SAS Studio with SAS OnDemand for Academics, then you need to upload your data to the OnDemand server because you can't read your C: drive with SAS OnDemand. But, you have a "home" directory on the server and generally, the naming convention for a "mystuff" folder in your home directory would be:
libname stuff '/home/userid/mystuff'; (where userid is your userid, such as if your log on userID is johndoe0, then your correct libname statement would be:
libname stuff '/home/johndoe0/mystuff';

Amy's technique for creating a folder and creating a libname should work for you. Otherwise the FAQ that Reeza posted should be useful.

cynthia
New Contributor
Posts: 3

Re: Libname statement in SAS Studio

Posted in reply to Cynthia_sas

I'm using Oracle VM Virtual Box and I'm using Windows 8.

 

I read explanations many times, but I'm still having difficulty.  May I put it this way?

 

If I put a sas dataset called abc.sas7bdat (I created this using regular SAS) say in "C:\SASUniversityEdition\myfolders," should I be able to read that file in SAS (using the free version of SAS)?  If Yes, I will try to read more and figure out.  

 

Thank you!

 

Kaz

 

 

 

Super User
Posts: 19,770

Re: Libname statement in SAS Studio

Yes, it's possible. The path would need to be:

C:\SASUniversityEdition\myfolders\abc.sas7bdat

You would create a libname in SAS UE as

libname mydata '/folders/myfolders/';

And because the box is unix, the paths are case sensitive, make sure the folder name is all lower case and the libname reference is also lower case.
Ask a Question
Discussion stats
  • 8 replies
  • 1762 views
  • 2 likes
  • 5 in conversation