Hi:
Let's say I have 3 SAS datasets:
students.sas7bdat
teachers.sas7bdat
courses.sas7bdat
And that these 3 datasets are physically stored in these possible locations/operating systems:
1) SAS On Windows on my local machine:
C:\Schools\K_12\Douglas
Then the LIBNAME statement would be:
libname Douglas 'c:\Schools\K_12\Douglas';
2) SAS On Windows, but mapped to my Q:drive
Q:\user111\Schools\K_12\Douglas
Then the LIBNAME statement would be:
libname Douglas 'q:\user111\Schools\K_12\Douglas';
3) SAS on a Unix/Linux server on a local network:
/home/usr/bin/usr111/Schools/K_12/Douglas
Then the LIBNAME statement would be:
libname Douglas '/home/usr/bin/usr111/Schools/K_12/Douglas';
4) SAS used with SAS OnDemand for Academics under a users Files (Home) top folder:
/home/u12345678/Schools/K_12/Douglas
Then the LIBNAME statement would be:
libname Douglas '/home/u12345678/Schools/K_12/Douglas';
Notice how each libname statement uses a "nickname" or library reference called Douglas in order to provide a reference that will point to that physical location on each operating system.
Now, no matter which operating system my files are physically stored on, this code below would work the same if run on each operating system, assuming the correct LIBNAME statement had been issued prior to running the steps.
In this case, since the files are permanently stored in a physical location on my operating system and since I now want to use SAS procedures with the SAS data, I can use a 2-level name in my SAS code to point to the specific SAS data table and SAS will know where to get the data from the folder location specified in the LIBNAME statement.
proc contents data=douglas.students;
title 'Show information about students at Douglas';
run;
proc print data=douglas.teachers;
title 'Display a list of teachers at Douglas Elementary';
run;
proc freq data=douglas.courses;
title 'Show how many courses in each grade_level at Douglas';
tables grade_level/ nocum nopercent;
run;
Hope this helps get you started. Our Programming 1 class goes into some detail about the LIBNAME statement to read SAS data and the XLSX Libname engine to read Excel files and helps you learn how to read CSV files and import them into SAS format. It's a free class and might be worth reviewing.
Cynthia