BookmarkSubscribeRSS Feed
michael971
Calcite | Level 5

This code does not work.

nocenter nonumber;


libname lsbex '/tutorials/bookdata/learning_sas_by_example';

data lsbex.dailyprices;

run;

proc  print   data=lsbex.dailyprices;

run;

1 REPLY 1
Cynthia_sas
Diamond | Level 26

Hi:

  How does the program "not work"? Do you get an error message that says you do NOT have write access to LSBEX library? Something like this:

     

ERROR: User does not have appropriate authorization level for library LSBEX.

     

  This is because you CANNOT write to the folder with the book data. It is read only. And, your program does not have a SET statement, so if your program had worked, you would have created an empty dataset -- but luckily the folder location for this data is READ ONLY, so you can't accidentally write over the data. Your LIBNAME statement is good. If you try something a bit different, you should be successful. Here's some code to try. My log from running the code in SAS OnDemand for Professionals is shown in the attached screen shot.

  If you want to write to a permanent location, then read the SAS OnDemand documentation about setting up your user location. The second screen shot shows an example of making a copy of LSBEX.DAILYPRICES in the user folder. The tilde symbol (~) in the LIBNAME statement is a shortcut reference for the longer path name /home/your_username/user folder. I like using the reference ~/user because it is shorter.

         

Cynthia

      
libname lsbex  '/tutorials/bookdata/learning_sas_by_example';

  

** will get ERROR message with this;

data lsbex.new;

run;

  

** this will make a WORK copy of the DAILYPRICES data;

data work.dailyprices;

  set lsbex.dailyprices;

run;

  

** this will show all the datasets in the library;

proc contents data=lsbex._all_;

run;


sodp_cody_book_libname.pngsodp_write_user_folder.png

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 1 reply
  • 1232 views
  • 0 likes
  • 2 in conversation