<?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 Re: LIBNAME error in sas Macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error-in-sas-Macro/m-p/839201#M331825</link>
    <description>&lt;P&gt;Thank you for the replies. It is indeed 'clear' .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But the problem still persists.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Log error:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;SPAN&gt;WARNING: Libref INPUT is not assigned.&lt;/SPAN&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Attaching new log.&lt;/P&gt;</description>
    <pubDate>Tue, 18 Oct 2022 14:38:19 GMT</pubDate>
    <dc:creator>Kp1234</dc:creator>
    <dc:date>2022-10-18T14:38:19Z</dc:date>
    <item>
      <title>LIBNAME error in sas Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error-in-sas-Macro/m-p/839194#M331821</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am creating a sas macro to read metadata file and assign libname depending on value obtained from metadata file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;*Read metadata file (works fine)*&lt;/P&gt;&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;PROC IMPORT OUT= Work.Metadata DATAFILE= "/home/pandek1/Reporting_DataMart/Input/Reporting_DataMart.xlsx" &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;DBMS=xlsx REPLACE;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;SHEET="Sheet1"; &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;GETNAMES=YES;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;RUN;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;*Macro to assign libname*&lt;/P&gt;&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;%Macro Study_list();&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;proc sql print;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;select distinct(Study) into :studylist separated by ' '&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;from Metadata;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;quit;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;%do i=1 %to %sysfunc(countw(&amp;amp;studylist,%str( )));&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;%let study_list=%scan(&amp;amp;studylist,&amp;amp;i,' '); &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;%put &amp;amp;study_list;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;%global ta compd study; *Works Fine*&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;data _null_;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;length ta compd study $ 10;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;ta=substr("&amp;amp;study_list",1,2);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;compd=substr("&amp;amp;study_list",3,3);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;study=substr("&amp;amp;study_list",7,3);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;run;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7" color="#3366FF"&gt;%let ccvpath="/gbs/prod/clin/data/&amp;amp;ta./&amp;amp;compd./&amp;amp;study./stable/blinded/level0";&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7" color="#3366FF"&gt;libname Input "&amp;amp;ccvpath" access=readonly;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7" color="#3366FF"&gt;libname Input clean;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;%end;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;%mend Study_list;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;%Study_list;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*SAS log message*&lt;/P&gt;&lt;DIV class=""&gt;&lt;FONT size="2" color="#FF0000"&gt;/gbs/prod/clin/data/ca/209/77T/stable/blinded/level0&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;FONT size="2" color="#FF0000"&gt;ERROR: The CLEAN engine cannot be found.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;FONT size="2" color="#FF0000"&gt;ERROR: Error in the LIBNAME statement.&lt;/FONT&gt;&lt;/DIV&gt;&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;I have tried using libname function inside data step but to no use.&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;Example: *libname(libref,ccvpath,);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The idea is to loop through libname and extract data depending on each libname value.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 14:15:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error-in-sas-Macro/m-p/839194#M331821</guid>
      <dc:creator>Kp1234</dc:creator>
      <dc:date>2022-10-18T14:15:39Z</dc:date>
    </item>
    <item>
      <title>Re: LIBNAME error in sas Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error-in-sas-Macro/m-p/839198#M331822</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let ccvpath="/gbs/prod/clin/data/&amp;amp;ta./&amp;amp;compd./&amp;amp;study./stable/blinded/level0";
libname Input "&amp;amp;ccvpath" access=readonly;

libname Input clean;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps you mean&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname Input clear;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise, I don't understand what you are trying to do, you need to explain what this LIBNAME is supposed to be doing.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 14:21:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error-in-sas-Macro/m-p/839198#M331822</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-10-18T14:21:38Z</dc:date>
    </item>
    <item>
      <title>Re: LIBNAME error in sas Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error-in-sas-Macro/m-p/839200#M331824</link>
      <description>&lt;P&gt;I guess you mean CLEAR?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 14:22:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error-in-sas-Macro/m-p/839200#M331824</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2022-10-18T14:22:36Z</dc:date>
    </item>
    <item>
      <title>Re: LIBNAME error in sas Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error-in-sas-Macro/m-p/839201#M331825</link>
      <description>&lt;P&gt;Thank you for the replies. It is indeed 'clear' .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But the problem still persists.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Log error:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;SPAN&gt;WARNING: Libref INPUT is not assigned.&lt;/SPAN&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Attaching new log.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 14:38:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error-in-sas-Macro/m-p/839201#M331825</guid>
      <dc:creator>Kp1234</dc:creator>
      <dc:date>2022-10-18T14:38:19Z</dc:date>
    </item>
    <item>
      <title>Re: LIBNAME error in sas Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error-in-sas-Macro/m-p/839207#M331827</link>
      <description>&lt;P&gt;These two statements do not make much sense.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let ccvpath="/gbs/prod/clin/data/&amp;amp;ta./&amp;amp;compd./&amp;amp;study./stable/blinded/level0";
libname Input "&amp;amp;ccvpath" access=readonly;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;First you are referencing three other macro variables to define CCVPATH.&lt;/P&gt;
&lt;P&gt;Do all of those macro variables have the value you expected?&lt;/P&gt;
&lt;P&gt;Where did you create them?&amp;nbsp;&lt;STRONG&gt; I do not see any code trying to create macro variables name TA, COMPD or STUDY in any of the code you posted.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And even if you did give them values you would end up generating libname statement with very strange use of quotes.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname Input ""/gbs/prod/clin/data/TA/COMPOUND/STUDY/stable/blinded/level0"" access=readonly;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Because of the strange quotes SAS will probably think that statement as 6 words in it instead of 4.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname Input "" /gbs/prod/clin/data/TA/COMPOUND/STUDY/stable/blinded/level0 "" access=readonly;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So it is going to see an empty path.&amp;nbsp; Then a option name it does not understand. Then another quoted empty string. And finally the ACCESS= option.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 15:08:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error-in-sas-Macro/m-p/839207#M331827</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-10-18T15:08:22Z</dc:date>
    </item>
    <item>
      <title>Re: LIBNAME error in sas Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error-in-sas-Macro/m-p/839209#M331828</link>
      <description>&lt;P&gt;Do you know that there's a libname function?&lt;/P&gt;
&lt;P&gt;So a data step is easier than macro especially for debugging.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=metadata;
by study;
run;

data create_libraries;
set metadata;
by study;
retain count;
if first.study then do;
ta=substr(study, 1, 2);
compd=substr(study, 3,3);
study = substr(study, 7, 3);

path = catx( '/', '/gbs/prod/clin/data/', ta, compd, study, 'stable/blinded/level0');
count+1; 
lib_name = catt('input', put(count, z2.));
rc = libname(lib_name, path);
end;

run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You can't create multiple libnames with different locations. They'll overwrite each other, so only the last library will be relevant.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Each library needs a unique name.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can create a single library that points to multiple locations but if the files have the same name that's problematic. Which one are you trying to do?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/304341"&gt;@Kp1234&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am creating a sas macro to read metadata file and assign libname depending on value obtained from metadata file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Code:&lt;/P&gt;
&lt;P&gt;*Read metadata file (works fine)*&lt;/P&gt;
&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;PROC IMPORT OUT= Work.Metadata DATAFILE= "/home/pandek1/Reporting_DataMart/Input/Reporting_DataMart.xlsx" &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;DBMS=xlsx REPLACE;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;SHEET="Sheet1"; &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;GETNAMES=YES;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;RUN;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;*Macro to assign libname*&lt;/P&gt;
&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;%Macro Study_list();&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;proc sql print;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;select distinct(Study) into :studylist separated by ' '&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;from Metadata;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;quit;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;%do i=1 %to %sysfunc(countw(&amp;amp;studylist,%str( )));&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;%let study_list=%scan(&amp;amp;studylist,&amp;amp;i,' '); &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;%put &amp;amp;study_list;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;%global ta compd study; *Works Fine*&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;data _null_;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;length ta compd study $ 10;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;ta=substr("&amp;amp;study_list",1,2);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;compd=substr("&amp;amp;study_list",3,3);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;study=substr("&amp;amp;study_list",7,3);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;run;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7" color="#3366FF"&gt;%let ccvpath="/gbs/prod/clin/data/&amp;amp;ta./&amp;amp;compd./&amp;amp;study./stable/blinded/level0";&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7" color="#3366FF"&gt;libname Input "&amp;amp;ccvpath" access=readonly;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7" color="#3366FF"&gt;libname Input clean;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;%end;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;%mend Study_list;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;%Study_list;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;*SAS log message*&lt;/P&gt;
&lt;DIV class=""&gt;&lt;FONT size="2" color="#FF0000"&gt;/gbs/prod/clin/data/ca/209/77T/stable/blinded/level0&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV class=""&gt;&lt;FONT size="2" color="#FF0000"&gt;ERROR: The CLEAN engine cannot be found.&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV class=""&gt;&lt;FONT size="2" color="#FF0000"&gt;ERROR: Error in the LIBNAME statement.&lt;/FONT&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;I have tried using libname function inside data step but to no use.&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="1 2 3 4 5 6 7"&gt;Example: *libname(libref,ccvpath,);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The idea is to loop through libname and extract data depending on each libname value.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 15:18:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error-in-sas-Macro/m-p/839209#M331828</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-10-18T15:18:26Z</dc:date>
    </item>
    <item>
      <title>Re: LIBNAME error in sas Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error-in-sas-Macro/m-p/839212#M331830</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;The idea is to loop through libname and extract data depending on each libname value.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;You don't appear to have any attempt to "extract" data.&amp;nbsp; What does that mean?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 15:26:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error-in-sas-Macro/m-p/839212#M331830</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-10-18T15:26:01Z</dc:date>
    </item>
    <item>
      <title>Re: LIBNAME error in sas Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error-in-sas-Macro/m-p/839218#M331833</link>
      <description>&lt;P&gt;Since you seem to by pulling only 8 characters from the variable STUDY why not just use those characters as the name of the libref?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC IMPORT
  DATAFILE= "/home/pandek1/Reporting_DataMart/Input/Reporting_DataMart.xlsx"
  DBMS=xlsx 
  OUT= metadata REPLACE
;
RUN; 

data metadata ;
  set metadata;
  length libref $8 ta compd studynum $10 path $200;
  ta=substr(study,1,2);
  compd=substr(study,3,3);
  studynum=substr(study,7,3);
  path=catx('/','/gbs/prod/clin/data',ta,compd,studynum,'stable/blinded/level0');
  libref=cats(ta,compd,studynum);
  rc=libname(libref,path,,'access=readonly');
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Oct 2022 15:40:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error-in-sas-Macro/m-p/839218#M331833</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-10-18T15:40:30Z</dc:date>
    </item>
    <item>
      <title>Re: LIBNAME error in sas Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error-in-sas-Macro/m-p/839231#M331840</link>
      <description>&lt;P&gt;You have definition for a path as:&lt;/P&gt;
&lt;PRE&gt; 80         %let ccvpath=/gbs/prod/clin/data/&amp;amp;ta/&amp;amp;compd/&amp;amp;study/stable/blinded/level0;
&lt;/PRE&gt;
&lt;P&gt;Where are the macro variables &amp;amp;ta, &amp;amp;compd and &amp;amp;study defined?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does your file system actually start at /gbs&amp;nbsp; as a drive or or mount point? Your Proc Import code, which you do not have in the log text, starts at /home so I suspect when you use that path in the Libname statement that is the problem, either undefined macro variables, incorrect start of path or both.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 16:35:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error-in-sas-Macro/m-p/839231#M331840</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-10-18T16:35:02Z</dc:date>
    </item>
    <item>
      <title>Re: LIBNAME error in sas Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error-in-sas-Macro/m-p/839269#M331847</link>
      <description>&lt;P&gt;This does not make sense:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data_null_;
length ta compd study $ 10;
ta=substr("&amp;amp;study_list",1,2);
compd=substr("&amp;amp;study_list",3,3);
study=substr("&amp;amp;study_list",7,3);
run;
%let ccvpath="/gbs/prod/clin/data/&amp;amp;ta./&amp;amp;compd./&amp;amp;study./stable/blinded/level0";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You create three&amp;nbsp;&lt;U&gt;data step variables&lt;/U&gt;, which immediately vanish once the data step terminates.&lt;/P&gt;
&lt;P&gt;And then you try to use three&amp;nbsp;&lt;U&gt;macro variables&lt;/U&gt; with the same names, which are never defined anywhere in your code.&lt;/P&gt;
&lt;P&gt;You probably have messages about undefined macro variables in your log.&lt;/P&gt;
&lt;P&gt;The macro language provides the %SUBSTR function, if you need to define macro variables.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Oct 2022 19:22:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/LIBNAME-error-in-sas-Macro/m-p/839269#M331847</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-10-18T19:22:28Z</dc:date>
    </item>
  </channel>
</rss>

