Desktop productivity for business analysts and programmers

Can I use the set statement in OnDemand to open a set in libraries

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 7
Accepted Solution

Can I use the set statement in OnDemand to open a set in libraries

Like Corn.corn


Accepted Solutions
Solution
‎07-07-2014 10:44 PM
SAS Super FREQ
Posts: 8,820

Re: Can I use the set statement in OnDemand to open a set in libraries

Hi:

  In my copy of SAS OnDemand for Professionals, I need to issue a LIBNAME statement to point to the location of the CORN dataset on the SASApp server. The code shown in the attached screen shot works for me. This is my LIBNAME statement:

libname corndata '/tutorials/eg/data/corn';

       
proc contents data=corndata._all_;

run;

  In the above instance, the CORN dataset is the only dataset in the library, so the 2-level name is: CORNDATA.CORN. But, of course, I could have given the library a nickname of WOMBAT or CORN or MYDATA, in which case, the 2-level name of the CORN dataset would have been: WOMBAT.CORN or CORN.CORN or MYDATA.CORN. It just depends.

  The attached code worked for me and produced output from the PROC CONTENTS, the PROC PRINT and the PROC FREQ. Give it a try on your OnDemand account.

cynthia


ondemand_corndata_libname_program.png

View solution in original post


All Replies
Solution
‎07-07-2014 10:44 PM
SAS Super FREQ
Posts: 8,820

Re: Can I use the set statement in OnDemand to open a set in libraries

Hi:

  In my copy of SAS OnDemand for Professionals, I need to issue a LIBNAME statement to point to the location of the CORN dataset on the SASApp server. The code shown in the attached screen shot works for me. This is my LIBNAME statement:

libname corndata '/tutorials/eg/data/corn';

       
proc contents data=corndata._all_;

run;

  In the above instance, the CORN dataset is the only dataset in the library, so the 2-level name is: CORNDATA.CORN. But, of course, I could have given the library a nickname of WOMBAT or CORN or MYDATA, in which case, the 2-level name of the CORN dataset would have been: WOMBAT.CORN or CORN.CORN or MYDATA.CORN. It just depends.

  The attached code worked for me and produced output from the PROC CONTENTS, the PROC PRINT and the PROC FREQ. Give it a try on your OnDemand account.

cynthia


ondemand_corndata_libname_program.png
Occasional Contributor
Posts: 7

Re: Can I use the set statement in OnDemand to open a set in libraries

Thanks for the help Cynthia.

Much appreciated.

My BIG questions is. "where the heck is "tutorials" defined???.

I don't see it anywhere but when I enter tutorials/eg , it is magically mapped to the SASApp/Libraries folder.

Coming from the Microsoft Visual Basic world, I find SAS program syntax so alien.

SAS Super FREQ
Posts: 8,820

Re: Can I use the set statement in OnDemand to open a set in libraries

Hi:

  The SAS OnDemand servers are "locked down" UNIX servers. So the /tutorials location is an alias for a physical drive name, which is hidden, as is the name of the machine and the names of all of the physical folders. So /tutorials/eg/data, was intentionally defined to be an aliased location by the folks who maintain the servers. Just as "SASApp" is one of the usual server names given to represent a server location -- but there probably is not a physical server machine named SASApp just as there is probably not a physical directory structure named /tutorials/eg/data, with just that exact name on the server. But having an alias location like this made it easy for commonly used datasets to be read-only on the server and accessible to multiple server users.

         

  In our e-learning classes, for example, we have explicit instructions about how to point to the /tutorials location for each class. In SAS OnDemand for Academics, the assumption is usually, that you will find out about the correct LIBNAME statement name from your professor (whether it is the /tutorials location or the location where your instructor loaded data, such as /courses/u_0/i_123/c_105).

                  
  The only reason I knew about the CORN data is that I can see it in my SAS OnDemand for Professionals image and I know, from the e-learning classes, what the correct path is. So, for the ECPRG2 class, the LIBNAME statement, for example, is:

libname ecprg2 '/tutorials/eg/data/ecprg2';

which meant that since ecprg2 and corn appear under the SASApp libraries that the LIBNAME statement for your question had to be something like:

libname wombat '/tutorials/eg/data/corn';

cynthia

Occasional Contributor
Posts: 7

Re: Can I use the set statement in OnDemand to open a set in libraries

Thanks Cynthia, I figured it was something that was hidden. Can you post the other Aliases for the OnDemand server?

SAS Super FREQ
Posts: 8,820

Re: Can I use the set statement in OnDemand to open a set in libraries


Hi, I only know of the /tutorials alias and a shortcut for the user location.  So I'm not understanding what you mean by "other aliases". For example, for our e-learning courses if I wanted to point to multiple classes, I might use the class name as the "nickname" or LIBREF:

Programming 1: libname ecprg1 '/tutorials/eg/data/ecprg1';

Programming 2: libname ecprg2 '/tutorials/eg/data/ecprg2';

Programming 3: libname ecprg3 '/tutorials/eg/data/ecprg3';

SQL 1: libname ecsql1 '/tutorials/eg/data/ecsql1';

Macro 1: libname ecmac1 '/tutorials/eg/data/ecmac1';

Corn: libname corndata '/tutorials/eg/data/corn';

           

  See the pattern? I've color coded it for you. Look at the name of the folders in my screen shot.

  

  The only other alias-like name that I know is the ~/user as a shortcut to the longer location /home/your_user_ID/user location, which is the user folder under SASApp in the Files location. See attached screen shot. If your professor has set up any other folders or files, you will have to get the path name from him/her. If there are aliases, I'm not sure what they would be. The SAS OnDemand for Academics server is slightly different from the SAS OnDemand for Professionals server.

cynthia


alias_vs_shortcut.png
🔒 This topic is solved and locked.

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

Discussion stats
  • 5 replies
  • 350 views
  • 0 likes
  • 2 in conversation