<?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: Macro variable for PATH created using SQL not working in libname statement. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-for-PATH-created-using-SQL-not-working-in-libname/m-p/844679#M333933</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/350312"&gt;@SASuserlot&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19879"&gt;@Quentin&lt;/a&gt;&amp;nbsp;. Yes, there is a note like that where I created a macro variable of the concatenation of 50 state names, separated by 'comma'&amp;nbsp; ( this variable is longer than 262 characters in length)to run a do loop ( it didn't affect anywhere else in my code except troubling the libname statement). How Can I&amp;nbsp; counteract this issue? Because I need this in the same session. Using 'NOQUOTELEMAX' will do anything?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;An aside to your original issue: Placing 50 state names into a single macro variable for a loop control seems like it is quite possible to approach the problem differently. Not so much a size of variable issue as whether the use of a macro variable is actually needed at all.&lt;/P&gt;</description>
    <pubDate>Wed, 16 Nov 2022 18:20:19 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2022-11-16T18:20:19Z</dc:date>
    <item>
      <title>Macro variable for PATH created using SQL not working in libname statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-for-PATH-created-using-SQL-not-working-in-libname/m-p/844542#M333884</link>
      <description>&lt;P&gt;Probably this can be a blind question, Since I can not share the path I am working. Sorry for&amp;nbsp; that.&lt;/P&gt;
&lt;P&gt;I created&amp;nbsp; a macro variable (Lib) using the dataset that contains the list of paths under the variable name 'Path' . When I try to create the library using libname statement I am getting the following error image with the &lt;FONT color="#0000FF"&gt;quoted string NOTE ( my path did not have any quotes )&lt;/FONT&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; My macro variable is resolving to the string that I expected. But library is not created.&amp;nbsp; If I copy the value from the path&amp;nbsp; variable and create a different dataset and creates the macro variable then it working. I am not sure what I am doing wrong. Can you please share your ideas what I need to check to correct it or what I am doing wrong (like you think any visible characters or spaces any thing to check).&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SASuserlot_0-1668560622698.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/77353iB5816D58EDDF0893/image-size/medium?v=v2&amp;amp;px=400" role="button" title="SASuserlot_0-1668560622698.png" alt="SASuserlot_0-1668560622698.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*libname not working;&lt;BR /&gt;options mprint mlogic symbolgen;&lt;BR /&gt;proc sql noprint;
select  strip(path)  into: lib
			 from county;
quit;

libname x "&amp;amp;lib" ;
***************************************;&lt;BR /&gt;&lt;BR /&gt;*libname statement working this method;&lt;BR /&gt;data file;&lt;BR /&gt;path= 'c:/actual/path/name';&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;proc sql noprint;&lt;BR /&gt;
select  strip(path)  into: lib
			 from file;
quit;

libname x "&amp;amp;lib" ;&lt;BR /&gt;
/*The actual path something looks similar below
path= G:/section/accounts/expenses-22/20 22/NJ/burlington/county/continuity/maintainanc;*/
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2022 01:06:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-for-PATH-created-using-SQL-not-working-in-libname/m-p/844542#M333884</guid>
      <dc:creator>SASuserlot</dc:creator>
      <dc:date>2022-11-16T01:06:24Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable for PATH created using SQL not working in libname statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-for-PATH-created-using-SQL-not-working-in-libname/m-p/844544#M333886</link>
      <description>&lt;P&gt;With this sort of problem, often the cause is an unmatched quote earlier in your SAS session.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The easiest way to test would be to make a permanent dataset temp.county.&amp;nbsp; Then start a new session and submit just:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select  strip(path)  into: lib
			 from temp.county;
quit;

%put &amp;gt;&amp;gt;&amp;amp;=lib&amp;lt;&amp;lt; ;

libname x "&amp;amp;lib" ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If that code works, it means your problem is somewhere earlier in your SAS session.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2022 02:17:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-for-PATH-created-using-SQL-not-working-in-libname/m-p/844544#M333886</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2022-11-16T02:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable for PATH created using SQL not working in libname statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-for-PATH-created-using-SQL-not-working-in-libname/m-p/844546#M333887</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19879"&gt;@Quentin&lt;/a&gt;&amp;nbsp;. Yes, there is a note like that where I created a macro variable of the concatenation of 50 state names, separated by 'comma'&amp;nbsp; ( this variable is longer than 262 characters in length)to run a do loop ( it didn't affect anywhere else in my code except troubling the libname statement). How Can I&amp;nbsp; counteract this issue? Because I need this in the same session. Using 'NOQUOTELEMAX' will do anything?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2022 02:46:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-for-PATH-created-using-SQL-not-working-in-libname/m-p/844546#M333887</guid>
      <dc:creator>SASuserlot</dc:creator>
      <dc:date>2022-11-16T02:46:13Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable for PATH created using SQL not working in libname statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-for-PATH-created-using-SQL-not-working-in-libname/m-p/844552#M333890</link>
      <description>&lt;P&gt;Using the STRIP() function is NOT going to prevent PROC SQL from adding the trailing spaces implied by the LENGTH of the variable selected into the resulting macro variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instead use the TRIMMED keyword.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select path
  into :lib trimmed
  from county
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you are going to add back the quotes later then include them in the macro variable.&amp;nbsp; This is especially important if the value already has the quote character.&amp;nbsp; Use the optional second parameter of the quote() function to have it use single quotes.&amp;nbsp; That is important if the string has macro trigger characters like &amp;amp; or % that would be evaluated by the macro processor if the string was bounded by double quote characters.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select quote(trim(path),"'")
  into :lib trimmed
  from county
;
quit;
libname x &amp;amp;lib ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or skip PROC SQL and MACRO code completely.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set county;
  rc=libname('x',path);
  put rc= path=;
  stop;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 16 Nov 2022 03:52:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-for-PATH-created-using-SQL-not-working-in-libname/m-p/844552#M333890</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-11-16T03:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable for PATH created using SQL not working in libname statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-for-PATH-created-using-SQL-not-working-in-libname/m-p/844622#M333920</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp; &amp;nbsp;Your second method using the quote and trim functions worked for me. Thank you again sharing your knowledge to me. I really don't like these 'Quoting' Issues in Macros.&lt;span class="lia-unicode-emoji" title=":persevering_face:"&gt;😣&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2022 14:14:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-for-PATH-created-using-SQL-not-working-in-libname/m-p/844622#M333920</guid>
      <dc:creator>SASuserlot</dc:creator>
      <dc:date>2022-11-16T14:14:59Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable for PATH created using SQL not working in libname statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-for-PATH-created-using-SQL-not-working-in-libname/m-p/844679#M333933</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/350312"&gt;@SASuserlot&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19879"&gt;@Quentin&lt;/a&gt;&amp;nbsp;. Yes, there is a note like that where I created a macro variable of the concatenation of 50 state names, separated by 'comma'&amp;nbsp; ( this variable is longer than 262 characters in length)to run a do loop ( it didn't affect anywhere else in my code except troubling the libname statement). How Can I&amp;nbsp; counteract this issue? Because I need this in the same session. Using 'NOQUOTELEMAX' will do anything?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;An aside to your original issue: Placing 50 state names into a single macro variable for a loop control seems like it is quite possible to approach the problem differently. Not so much a size of variable issue as whether the use of a macro variable is actually needed at all.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2022 18:20:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-for-PATH-created-using-SQL-not-working-in-libname/m-p/844679#M333933</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-11-16T18:20:19Z</dc:date>
    </item>
    <item>
      <title>Re: Macro variable for PATH created using SQL not working in libname statement.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-variable-for-PATH-created-using-SQL-not-working-in-libname/m-p/844681#M333935</link>
      <description>&lt;P&gt;&amp;nbsp;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp; for bringing this attention. I am kind of new at macros, so I am starting at small macros and&amp;nbsp; on my way to go complex.&amp;nbsp; Yes I do understand what you saying. Macro variable was created&amp;nbsp; to run through a do - loop macro where every time , it has to choose the&amp;nbsp; state based on the iteration ( created separate number for the iteration) in order to avoid every time entering the&amp;nbsp; state name when calling the macro. I wish I could I can&amp;nbsp; show my code, so that I can get better and easy option from you guys ( unfortunately my code have lot of privacy information, Usually I try to give dummy code as much as I can share or piece of code where I stuck).&lt;/P&gt;</description>
      <pubDate>Wed, 16 Nov 2022 18:43:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-variable-for-PATH-created-using-SQL-not-working-in-libname/m-p/844681#M333935</guid>
      <dc:creator>SASuserlot</dc:creator>
      <dc:date>2022-11-16T18:43:38Z</dc:date>
    </item>
  </channel>
</rss>

