Hi,
I have a folder with two levels. The first level has 20 second level folders. I have sasfiles in each of the second level and will like to create a single libname for them. How do I do that?
For example:
First level folder : /_U/N/RC/Proj/SAS
Second level folder : /_U/N/RC/Proj/SAS/data1/a.sas7bdat
/_U/N/RC/Proj/SAS/data2/b.sas7bdat
/_U/N/RC/Proj/SAS/data3/c.sas7bdat
/_U/N/RC/Proj/SAS/data4/d.sas7bdat
When I write a libname to reference all the second level files using the
libname x "/_U/N/RC/Proj/SAS"; run;
its not working and I do not want to go through the pain of writing 20 libnames and putting all the libref in another single libname or is that what I have to do?
Note: BDAT files should not be part of a "libname" they are the data sets.
A libname statement to reference multiple folders needs to list them. One way is below. Note the ( ) around the list.
libname x ("/_U/N/RC/Proj/SAS/data1" "/_U/N/RC/Proj/SAS/data2"
"/_U/N/RC/Proj/SAS/data3" "/_U/N/RC/Proj/SAS/data4"
);
another would be assign a different libname to each folder and then create composite library. Assuming you created libraries named Lib1 through lib4 , one for each folder. Then the library All would include all of them.
libname all (lib1 lib2 lib3 lib4);
Caution: duplicate data set names in multiple folders will be difficult to work with.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.