<?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 Call Execute syntax in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Call-Execute-syntax/m-p/57428#M16009</link>
    <description>I am trying to understand how Call Execute works.. I tried a very simple program which creates a library reference&lt;BR /&gt;
&lt;BR /&gt;
Below is sample code..&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
set files;&lt;BR /&gt;
call execute('LIBNAME sasdata2 ''C:\DAG\SAS\Samples\'';'&lt;BR /&gt;
);&lt;BR /&gt;
&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
It runs fine with following in the log - &lt;BR /&gt;
&lt;BR /&gt;
 + LIBNAME sasdata2 'C:\DAG\SAS\Samples\';&lt;BR /&gt;
NOTE: Libref SASDATA2 was successfully assigned as follows:&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Now if I change my code to use a variable instead of actual string value for libname&lt;BR /&gt;
as below&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
set files;&lt;BR /&gt;
call execute('LIBNAME sasdata2 '''||folderName||''';'&lt;BR /&gt;
);&lt;BR /&gt;
&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
I get the following - &lt;BR /&gt;
&lt;BR /&gt;
NOTE: CALL EXECUTE generated line.&lt;BR /&gt;
1   + LIBNAME sasdata2 'C:\DAG\SAS\Samples\&lt;BR /&gt;
2   +&lt;BR /&gt;
WARNING: The quoted string currently being processed has become more than 262 characters long.  You may have&lt;BR /&gt;
         unbalanced quotation marks.&lt;BR /&gt;
3   +                                                                                                             ';&lt;BR /&gt;
ERROR: Invalid physical name for library SASDATA2.&lt;BR /&gt;
ERROR: Error in the LIBNAME statement.&lt;BR /&gt;
4   + LIBNAME sasdata2 'C:\DAG\SAS\Samples\&lt;BR /&gt;
5   +&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
it seems to be taking the right value from the dataset files. I tried some changes in quoatations i have, to see if there is any issue. But didn't help.&lt;BR /&gt;
&lt;BR /&gt;
Any suggestions??&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Neel</description>
    <pubDate>Wed, 22 Jul 2009 18:37:50 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-07-22T18:37:50Z</dc:date>
    <item>
      <title>Call Execute syntax</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Call-Execute-syntax/m-p/57428#M16009</link>
      <description>I am trying to understand how Call Execute works.. I tried a very simple program which creates a library reference&lt;BR /&gt;
&lt;BR /&gt;
Below is sample code..&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
set files;&lt;BR /&gt;
call execute('LIBNAME sasdata2 ''C:\DAG\SAS\Samples\'';'&lt;BR /&gt;
);&lt;BR /&gt;
&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
It runs fine with following in the log - &lt;BR /&gt;
&lt;BR /&gt;
 + LIBNAME sasdata2 'C:\DAG\SAS\Samples\';&lt;BR /&gt;
NOTE: Libref SASDATA2 was successfully assigned as follows:&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Now if I change my code to use a variable instead of actual string value for libname&lt;BR /&gt;
as below&lt;BR /&gt;
&lt;BR /&gt;
data _null_;&lt;BR /&gt;
set files;&lt;BR /&gt;
call execute('LIBNAME sasdata2 '''||folderName||''';'&lt;BR /&gt;
);&lt;BR /&gt;
&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
I get the following - &lt;BR /&gt;
&lt;BR /&gt;
NOTE: CALL EXECUTE generated line.&lt;BR /&gt;
1   + LIBNAME sasdata2 'C:\DAG\SAS\Samples\&lt;BR /&gt;
2   +&lt;BR /&gt;
WARNING: The quoted string currently being processed has become more than 262 characters long.  You may have&lt;BR /&gt;
         unbalanced quotation marks.&lt;BR /&gt;
3   +                                                                                                             ';&lt;BR /&gt;
ERROR: Invalid physical name for library SASDATA2.&lt;BR /&gt;
ERROR: Error in the LIBNAME statement.&lt;BR /&gt;
4   + LIBNAME sasdata2 'C:\DAG\SAS\Samples\&lt;BR /&gt;
5   +&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
it seems to be taking the right value from the dataset files. I tried some changes in quoatations i have, to see if there is any issue. But didn't help.&lt;BR /&gt;
&lt;BR /&gt;
Any suggestions??&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Neel</description>
      <pubDate>Wed, 22 Jul 2009 18:37:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Call-Execute-syntax/m-p/57428#M16009</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-07-22T18:37:50Z</dc:date>
    </item>
    <item>
      <title>Re: Call Execute syntax</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Call-Execute-syntax/m-p/57429#M16010</link>
      <description>The SAS variable is padded with blanks - you need to use TRIM against your variable.  You may want consider building the command in a SAS variable and then use the SAS variable in your CALL EXECUTE rather than attempting to build the command string in the CALL - it may be easier to debug that way as well.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Wed, 22 Jul 2009 18:46:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Call-Execute-syntax/m-p/57429#M16010</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-07-22T18:46:22Z</dc:date>
    </item>
    <item>
      <title>Re: Call Execute syntax</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Call-Execute-syntax/m-p/57430#M16011</link>
      <description>To create LIBREFS from meta data it might be easier to use the LIBNAME function.   You can also easily test the return code.</description>
      <pubDate>Wed, 22 Jul 2009 20:21:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Call-Execute-syntax/m-p/57430#M16011</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2009-07-22T20:21:03Z</dc:date>
    </item>
  </channel>
</rss>

