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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.