<?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: Error in the libname statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Error-in-the-libname-statement/m-p/917887#M361573</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/423316"&gt;@melhaf&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Librefs cannot be longer than 8 characters (see &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsglobal/n1nk65k2vsfmxfn1wu17fntzszbp.htm" target="_blank" rel="noopener"&gt;documentation of the LIBNAME statement&lt;/A&gt;), so &lt;FONT face="courier new,courier"&gt;results_&lt;EM&gt;n&lt;/EM&gt;&amp;nbsp;&lt;/FONT&gt;is too long.&lt;/LI&gt;
&lt;LI&gt;Omit the quotation marks in the %LET statement for macro variable &lt;FONT face="courier new,courier"&gt;Path&lt;/FONT&gt;. Otherwise they will be duplicated in your LIBNAME statements. Ideally, avoid the unwanted duplication of backslashes, too.&lt;/LI&gt;
&lt;LI&gt;Even with the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lesysoptsref/n1pihdnfpj4b32n1t62lx0zdsmdn.htm" target="_blank" rel="noopener"&gt;DLCREATEDIR system option&lt;/A&gt; you can only create one folder at a time, so use a step-by-step approach or use other methods to create the folders beforehand:&lt;BR /&gt;
&lt;PRE&gt;libname res2 "&amp;amp;Path.\&amp;amp;Year.";
libname res2 "&amp;amp;Path.\&amp;amp;Year.\&amp;amp;FRUIT.";
libname res2 "&amp;amp;Path.\&amp;amp;Year.\&amp;amp;FRUIT.\&amp;amp;TOPPING.";&lt;/PRE&gt;
&lt;/LI&gt;
&lt;/OL&gt;</description>
    <pubDate>Mon, 26 Feb 2024 10:56:17 GMT</pubDate>
    <dc:creator>FreelanceReinh</dc:creator>
    <dc:date>2024-02-26T10:56:17Z</dc:date>
    <item>
      <title>Error in the libname statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-in-the-libname-statement/m-p/917883#M361571</link>
      <description>&lt;P&gt;if I resolve my macro variables like this&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%let YEAR=2023:
%let FRUIT=orange; &amp;nbsp;&amp;nbsp;
%let TOPPING= chocolate;
%let Path= "C:\Deskop\My folder\";

libname results_1 "&amp;amp;Path.\Data\&amp;amp;FRUIT.\&amp;amp;TOPPING\&amp;amp;Year.";  /*this works*/
libname results_2 "&amp;amp;Path.&amp;amp;Year.\Data\&amp;amp;FRUIT.\&amp;amp;TOPPING.";  /*this don't work, and I would like this one to work since it is more efficient */

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The error i get is:&amp;nbsp;&lt;BR /&gt;&lt;CODE class=""&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;PRE&gt;107 libname results_1;&lt;BR /&gt;NOTE: Libref OUT was successfully assigned as follows:&lt;BR /&gt;Engine: V9&lt;BR /&gt;Physical Name: ....&lt;/PRE&gt;&lt;PRE&gt;&lt;BR /&gt;108 libname results_2&lt;BR /&gt;ERROR: Create of library results_2 failed.&lt;BR /&gt;ERROR: Error in the LIBNAME statement.&lt;BR /&gt;&lt;BR /&gt;&lt;CODE class=""&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV&gt;How do I solve this?&lt;/DIV&gt;</description>
      <pubDate>Mon, 26 Feb 2024 09:33:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-in-the-libname-statement/m-p/917883#M361571</guid>
      <dc:creator>melhaf</dc:creator>
      <dc:date>2024-02-26T09:33:15Z</dc:date>
    </item>
    <item>
      <title>Re: Error in the libname statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-in-the-libname-statement/m-p/917885#M361572</link>
      <description>&lt;P&gt;If directory:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;"&amp;amp;Path.&amp;amp;Year.\Data\&amp;amp;FRUIT.\&amp;amp;TOPPING."&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;does not exist, you won't be able to assign a library.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Remember libname statement does NOT create directories, it assigns libref to existing one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Mon, 26 Feb 2024 10:07:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-in-the-libname-statement/m-p/917885#M361572</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2024-02-26T10:07:03Z</dc:date>
    </item>
    <item>
      <title>Re: Error in the libname statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-in-the-libname-statement/m-p/917887#M361573</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/423316"&gt;@melhaf&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Librefs cannot be longer than 8 characters (see &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsglobal/n1nk65k2vsfmxfn1wu17fntzszbp.htm" target="_blank" rel="noopener"&gt;documentation of the LIBNAME statement&lt;/A&gt;), so &lt;FONT face="courier new,courier"&gt;results_&lt;EM&gt;n&lt;/EM&gt;&amp;nbsp;&lt;/FONT&gt;is too long.&lt;/LI&gt;
&lt;LI&gt;Omit the quotation marks in the %LET statement for macro variable &lt;FONT face="courier new,courier"&gt;Path&lt;/FONT&gt;. Otherwise they will be duplicated in your LIBNAME statements. Ideally, avoid the unwanted duplication of backslashes, too.&lt;/LI&gt;
&lt;LI&gt;Even with the &lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lesysoptsref/n1pihdnfpj4b32n1t62lx0zdsmdn.htm" target="_blank" rel="noopener"&gt;DLCREATEDIR system option&lt;/A&gt; you can only create one folder at a time, so use a step-by-step approach or use other methods to create the folders beforehand:&lt;BR /&gt;
&lt;PRE&gt;libname res2 "&amp;amp;Path.\&amp;amp;Year.";
libname res2 "&amp;amp;Path.\&amp;amp;Year.\&amp;amp;FRUIT.";
libname res2 "&amp;amp;Path.\&amp;amp;Year.\&amp;amp;FRUIT.\&amp;amp;TOPPING.";&lt;/PRE&gt;
&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Mon, 26 Feb 2024 10:56:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-in-the-libname-statement/m-p/917887#M361573</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2024-02-26T10:56:17Z</dc:date>
    </item>
    <item>
      <title>Re: Error in the libname statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-in-the-libname-statement/m-p/917923#M361587</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/423316"&gt;@melhaf&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;if I resolve my macro variables like this&lt;/P&gt;
&lt;DIV&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;%let YEAR=2023:
%let FRUIT=orange; &amp;nbsp;&amp;nbsp;
%let TOPPING= chocolate;
%let Path= "C:\Deskop\My folder\";

libname results_1 "&amp;amp;Path.\Data\&amp;amp;FRUIT.\&amp;amp;TOPPING\&amp;amp;Year.";  /*this works*/
libname results_2 "&amp;amp;Path.&amp;amp;Year.\Data\&amp;amp;FRUIT.\&amp;amp;TOPPING.";  /*this don't work, and I would like this one to work since it is more efficient */

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The error i get is:&amp;nbsp;&lt;BR /&gt;&lt;CODE class=""&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;PRE&gt;107 libname results_1;&lt;BR /&gt;NOTE: Libref OUT was successfully assigned as follows:&lt;BR /&gt;Engine: V9&lt;BR /&gt;Physical Name: ....&lt;/PRE&gt;
&lt;PRE&gt;&lt;BR /&gt;108 libname results_2&lt;BR /&gt;ERROR: Create of library results_2 failed.&lt;BR /&gt;ERROR: Error in the LIBNAME statement.&lt;BR /&gt;&lt;BR /&gt;&lt;CODE class=""&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;DIV&gt;How do I solve this?&lt;/DIV&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I want to see&amp;nbsp; your LOG where the "this works" actually assigned a library. I expect unbalanced quotes to generate an error&lt;/P&gt;
&lt;P&gt;&lt;CODE class=""&gt;%let Path= "C:\Deskop\My folder\";

libname results_1 "&amp;amp;Path.\Data\&amp;amp;FRUIT.\&amp;amp;TOPPING\&amp;amp;Year."; &lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;Would create this line of code:&lt;BR /&gt;libname results_1 ""C:\desktop\My Folder\"\Data\orange\chocolate\2023";&lt;/P&gt;
&lt;P&gt;The quotes around the PATH portion of your string would almost certainly cause an error in BOTH libname statements. &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Feb 2024 16:29:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-in-the-libname-statement/m-p/917923#M361587</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-02-26T16:29:34Z</dc:date>
    </item>
    <item>
      <title>Re: Error in the libname statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-in-the-libname-statement/m-p/917930#M361589</link>
      <description>&lt;P&gt;Hello &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/423316"&gt;@melhaf&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I agree with what &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt; has said.&lt;BR /&gt;You must modify your path statement as follows&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Path= C:\Desktop\My folder ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;As a reminder while creating a macro variable, anything between the &lt;STRONG&gt;=&lt;/STRONG&gt; and semicolon&amp;nbsp;&lt;STRONG&gt; ;&lt;/STRONG&gt; are a part of the macro variable including quotes.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Feb 2024 18:15:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-in-the-libname-statement/m-p/917930#M361589</guid>
      <dc:creator>Sajid01</dc:creator>
      <dc:date>2024-02-26T18:15:59Z</dc:date>
    </item>
  </channel>
</rss>

