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;
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;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.