<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Assign libref to multiple sas files in multiple folders in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Assign-libref-to-multiple-sas-files-in-multiple-folders/m-p/939976#M369015</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have a CCW folder with multiple years CCW - 2006 to 2021. Within each year folder, I have multiple sas data files. I would like to have all these files referenced in a single libref so that when I lunch the libref, i can work on any sas files in any year. For example, I tired something like this but did not work. I am using sas studio.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%let path= ('/_ABC_CDB_SASDS/CCW/2006', '/_ABC_CDB_SASDS/CCW/2007');
%macro setdelim;
   %global delim;
   %if %index(&amp;amp;path,%str(/)) %then %let delim=%str(/);
   %else %let delim=%str(\);
%mend;
%setdelim
libname ccw "&amp;amp;path";


proc contents data=ccw.bcarclms2006; run;
proc contents data=ccw.bcarclms2007; run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 19 Aug 2024 18:37:18 GMT</pubDate>
    <dc:creator>CathyVI</dc:creator>
    <dc:date>2024-08-19T18:37:18Z</dc:date>
    <item>
      <title>Assign libref to multiple sas files in multiple folders</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-libref-to-multiple-sas-files-in-multiple-folders/m-p/939976#M369015</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have a CCW folder with multiple years CCW - 2006 to 2021. Within each year folder, I have multiple sas data files. I would like to have all these files referenced in a single libref so that when I lunch the libref, i can work on any sas files in any year. For example, I tired something like this but did not work. I am using sas studio.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%let path= ('/_ABC_CDB_SASDS/CCW/2006', '/_ABC_CDB_SASDS/CCW/2007');
%macro setdelim;
   %global delim;
   %if %index(&amp;amp;path,%str(/)) %then %let delim=%str(/);
   %else %let delim=%str(\);
%mend;
%setdelim
libname ccw "&amp;amp;path";


proc contents data=ccw.bcarclms2006; run;
proc contents data=ccw.bcarclms2007; run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2024 18:37:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-libref-to-multiple-sas-files-in-multiple-folders/m-p/939976#M369015</guid>
      <dc:creator>CathyVI</dc:creator>
      <dc:date>2024-08-19T18:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: Assign libref to multiple sas files in multiple folders</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-libref-to-multiple-sas-files-in-multiple-folders/m-p/939985#M369017</link>
      <description>&lt;P&gt;Obviously cannot test your code as we don't have your file set up.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You want to make sure that each element of a file path starts at either a drive letter (Windows) or the root mount point for other storage. Otherwise the paths are relative to where the SAS session is executing from.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, the path has to be as seen by your SAS session server if you are using anything other than a purely local machine SAS install.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that if any of the data set names appear in more than one folder you will only see one in the library and which one may not be predictable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Aug 2024 19:34:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-libref-to-multiple-sas-files-in-multiple-folders/m-p/939985#M369017</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-08-19T19:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: Assign libref to multiple sas files in multiple folders</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-libref-to-multiple-sas-files-in-multiple-folders/m-p/939988#M369020</link>
      <description>If you hardcode that approach with the correct file paths does it work?&lt;BR /&gt;&lt;BR /&gt; If so, then the issue is with how you're generating the paths and you can work backwards and fix it. &lt;BR /&gt;&lt;BR /&gt;If not, then the issue is with the connection to that location and you need to fix the file paths or ensure you have access. &lt;BR /&gt;&lt;BR /&gt;What is the purpose of the setdelim? It isn't related to the rest of the code so having it in the middle there seems weird.</description>
      <pubDate>Mon, 19 Aug 2024 20:00:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-libref-to-multiple-sas-files-in-multiple-folders/m-p/939988#M369020</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2024-08-19T20:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: Assign libref to multiple sas files in multiple folders</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-libref-to-multiple-sas-files-in-multiple-folders/m-p/939989#M369021</link>
      <description>&lt;P&gt;What did your SAS log report?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For starters&amp;nbsp; you don't need double quotes so try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let path= ('/_ABC_CDB_SASDS/CCW/2006', '/_ABC_CDB_SASDS/CCW/2007');
libname ccw &amp;amp;path;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Aug 2024 20:00:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-libref-to-multiple-sas-files-in-multiple-folders/m-p/939989#M369021</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2024-08-19T20:00:11Z</dc:date>
    </item>
    <item>
      <title>Re: Assign libref to multiple sas files in multiple folders</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-libref-to-multiple-sas-files-in-multiple-folders/m-p/940045#M369035</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13976"&gt;@SASKiwi&lt;/a&gt;&amp;nbsp; Thank you. I am familiar with the process that you shared. Please is there another way to do it.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Aug 2024 03:14:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-libref-to-multiple-sas-files-in-multiple-folders/m-p/940045#M369035</guid>
      <dc:creator>CathyVI</dc:creator>
      <dc:date>2024-08-20T03:14:05Z</dc:date>
    </item>
    <item>
      <title>Re: Assign libref to multiple sas files in multiple folders</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Assign-libref-to-multiple-sas-files-in-multiple-folders/m-p/940047#M369036</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/253321"&gt;@CathyVI&lt;/a&gt;&amp;nbsp; - I suggest you first try defining a LIBNAME for one folder. Does that work? You can concatenate two existing libraries into a third one:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname L1 '/Folder1';
libname L2 '/Folder2';
libname L3 (L1 L2);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp; Also, there was an error in your example that I didn't spot until now (remove comma between the paths):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let path= ('/_ABC_CDB_SASDS/CCW/2006' '/_ABC_CDB_SASDS/CCW/2007');
libname ccw &amp;amp;path;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Aug 2024 03:32:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Assign-libref-to-multiple-sas-files-in-multiple-folders/m-p/940047#M369036</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2024-08-20T03:32:59Z</dc:date>
    </item>
  </channel>
</rss>

