<?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 example in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/CALL-EXECUTE-example/m-p/254951#M48663</link>
    <description>&lt;P&gt;Here I have an example of using CALL EXECUTE. I wonder why the second code does not work when I omit the concatenation oeprator. &amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input a $;
cards;
1
2
3
;

data _null_;
	set test end=last;
    call execute('proc print data=sashelp.class (obs='||a||'); run;');
run;

data test;
input a $;
cards;
1
2
3
;

data _null_;
	set test end=last;
    call execute('proc print data=sashelp.class (obs='a'); run;');
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 07 Mar 2016 14:44:54 GMT</pubDate>
    <dc:creator>SAS_inquisitive</dc:creator>
    <dc:date>2016-03-07T14:44:54Z</dc:date>
    <item>
      <title>CALL EXECUTE example</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-EXECUTE-example/m-p/254951#M48663</link>
      <description>&lt;P&gt;Here I have an example of using CALL EXECUTE. I wonder why the second code does not work when I omit the concatenation oeprator. &amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
input a $;
cards;
1
2
3
;

data _null_;
	set test end=last;
    call execute('proc print data=sashelp.class (obs='||a||'); run;');
run;

data test;
input a $;
cards;
1
2
3
;

data _null_;
	set test end=last;
    call execute('proc print data=sashelp.class (obs='a'); run;');
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2016 14:44:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-EXECUTE-example/m-p/254951#M48663</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2016-03-07T14:44:54Z</dc:date>
    </item>
    <item>
      <title>Re: CALL EXECUTE example</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-EXECUTE-example/m-p/254952#M48664</link>
      <description>&lt;P&gt;This message:&lt;/P&gt;
&lt;PRE&gt;ERROR 253-185: The EXECUTE subroutine call has too many arguments.&lt;/PRE&gt;
&lt;P&gt;provides the answer.&lt;/P&gt;
&lt;P&gt;CALL EXECUTE expects ONE argument of type character. You are supplying three: a string constant, a variable of type character, and another string constant.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2016 14:41:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-EXECUTE-example/m-p/254952#M48664</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-03-07T14:41:35Z</dc:date>
    </item>
    <item>
      <title>Re: CALL EXECUTE example</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-EXECUTE-example/m-p/254953#M48665</link>
      <description>&lt;P&gt;Because it isn't valid SAS code. The string isn't being created, there's no default concatenation.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2016 14:42:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-EXECUTE-example/m-p/254953#M48665</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-03-07T14:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: CALL EXECUTE example</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-EXECUTE-example/m-p/254955#M48666</link>
      <description>&lt;P&gt;The call execute function requires a string to be passed to it as its only parameter. This&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token string"&gt;'proc print data=sashelp.class (obs='&lt;/SPAN&gt;a&lt;SPAN class="token string"&gt;'); run;'&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is not a string, it is two strings:&lt;/P&gt;
&lt;P&gt;'proc print data=sashelp.class (obs='&lt;/P&gt;
&lt;P&gt;'); run;'&lt;/P&gt;
&lt;P&gt;and something undefined. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;Function form:&lt;/P&gt;
&lt;P&gt;call execute(&amp;lt;string&amp;gt;);&lt;/P&gt;
&lt;P&gt;By using the concatenate symbols you are creating one string out of the two given strings and the value held in the variable a.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One other thing, as a string in the dataset is given a length of 8 (as you didn't define it!) you may want to use cats:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  set test end=last;
  call execute(cats('proc print data=sashelp.class (obs=',a,'); run;'));
run;&lt;/PRE&gt;
&lt;P&gt;This should remove any blanks around a.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2016 14:46:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-EXECUTE-example/m-p/254955#M48666</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-03-07T14:46:32Z</dc:date>
    </item>
    <item>
      <title>Re: CALL EXECUTE example</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-EXECUTE-example/m-p/254957#M48667</link>
      <description>&lt;P&gt;Thank you, all. I was assuming I was creating a string by enclosing variable a in quotation marks.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2016 14:54:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-EXECUTE-example/m-p/254957#M48667</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2016-03-07T14:54:00Z</dc:date>
    </item>
  </channel>
</rss>

