BookmarkSubscribeRSS Feed
oldeks
Calcite | Level 5

I am working in SAS on demand.

This is the code I used. I have tried many different cases for the library and data set names, and nothing seems to work. I briefly got it to work yesterday, and I could see the data set in the mydata library, but then it disappeared this morning and I can't seem to make anything work. Is it just not possible to save data sets in SAS on demand? 

 

LIBNAME mydata 'C:\MYDATA';

data mydata.trial;
input name $ sex $ age;
label name = "first name"
sex = "birth sex";
cards;
kristin 2 54
stacy 1 56
;
run;


proc print data= mydata.trial label;
run;

2 REPLIES 2
PaigeMiller
Diamond | Level 26

Are you running this in SAS/Studio? If so, SAS/Studio cannot access files or folders on your local computer's hard drives.

 

You have to create libraries on the server where SAS/Studio is running. You mentioned SAS On Demand, here is how I use the LIBNAME statement 

 

libname mydata "/home/paige.miller3";

data mydata.class;
	set sashelp.class;
run;

 

Of course, you would have to use a different folder than PAIGE.MILLER3, it has to be a folder the exists in your SAS On Demand.

--
Paige Miller
Kurt_Bremser
Super User

With SAS On Demand, the actual SAS process (which you access through the SAS Studio web application) runs on a Linux-based cloud server. You must use UNIX-style syntax for file and path names. UNIX does not have drive letters, but a single directory tree which starts at "root", symbolized by a slash. You "own" your home directory, and the system provides a shortcut to it, symbolized by a tilde. So if you created a directory/folder called mydata in your home folder in the Studio navigation tab, in your code you would use

libname mydata "~/mydata";

Also note that UNIX operating systems are case sensitive, mydata and Mydata would be different objects.

 

In the future, always post the complete log of code that fails by copy/pasting the text into a window opened with this button:

Bildschirmfoto 2020-04-07 um 08.32.59.jpg

The log is our primary diagnostic tool, see Maxim 2.

Catch up on SAS Innovate 2026

Dive into keynotes, announcements and breakthroughs on demand.

Explore Now →
Develop Code with SAS Studio

Get started using SAS Studio to write, run and debug your SAS programs.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 262 views
  • 0 likes
  • 3 in conversation