<?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: Call execute in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Call-execute/m-p/471746#M120867</link>
    <description>&lt;P&gt;PROC APPEND to append data is faster - it copies data in blocks, not one line at a time like a data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please mark&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;&amp;nbsp;solution as the answer, not your own post.&lt;/P&gt;</description>
    <pubDate>Wed, 20 Jun 2018 15:41:29 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2018-06-20T15:41:29Z</dc:date>
    <item>
      <title>Call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-execute/m-p/471712#M120856</link>
      <description>&lt;P&gt;Hi SAS experts,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a question and thanks for your help in advance.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I used the following macro and call execute to stack dates from a couple of dates, meanwhile, I wanted to add a variable containing the source of the dates using "&lt;SPAN&gt;var="&amp;amp;dtc."&lt;/SPAN&gt;, but I failed. I got a&amp;nbsp;message in log that 'var="||NAME||" where I actually wanted it to be equal to the name in alldtc data;' I've attached the snapshot for alldtc data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data dtc_p1;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro dtcmap(in,dtc);&lt;BR /&gt;&amp;nbsp; data dtcmap;&lt;BR /&gt;&amp;nbsp; set &amp;amp;in;&lt;BR /&gt;&amp;nbsp; length dtc var $19.;&lt;BR /&gt;&amp;nbsp; dtc=substr(&amp;amp;dtc.,1,10);&lt;BR /&gt;&amp;nbsp; if dtc^='';&lt;/P&gt;&lt;P&gt;&amp;nbsp; var="&amp;amp;dtc.";&lt;BR /&gt;&amp;nbsp; keep usubjid dtc var;&lt;BR /&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; data dtc_p1;&lt;BR /&gt;&amp;nbsp; set dtc_p1&lt;BR /&gt;&amp;nbsp; dtcmap;&lt;BR /&gt;&amp;nbsp; run;&lt;BR /&gt;%mend dtcmap;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;&amp;nbsp; set alldtc(where=(name not in ('SESTDTC' 'SEENDTC' 'DTHDTC')));&lt;BR /&gt;&amp;nbsp; call execute ("%dtcmap(ags307."||strip(memname)||","||NAME||")");&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jun 2018 14:37:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-execute/m-p/471712#M120856</guid>
      <dc:creator>fbl204653</dc:creator>
      <dc:date>2018-06-20T14:37:33Z</dc:date>
    </item>
    <item>
      <title>Re: Call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-execute/m-p/471717#M120859</link>
      <description>dtc=substr(&amp;amp;dtc.,1,10);  &amp;lt;- quote the DTC variable here since it's a string variable. You can also use SCAN() instead. If this doesn't fix it, please post your log from running the program with debugging options on. &lt;BR /&gt;&lt;BR /&gt;options mprint symbolgen;</description>
      <pubDate>Wed, 20 Jun 2018 14:52:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-execute/m-p/471717#M120859</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-20T14:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: Call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-execute/m-p/471726#M120861</link>
      <description>&lt;P&gt;I would suggest that this:&lt;/P&gt;
&lt;PRE&gt;  call execute ("%dtcmap(ags307."||strip(memname)||","||NAME||")");
&lt;/PRE&gt;
&lt;P&gt;Is not a good idea.&amp;nbsp; Doube quotes invokes the macro processor, use single quotes:&lt;/P&gt;
&lt;PRE&gt;  call execute (cats('%dtcmap(ags307.',memname,',',name,')'));
&lt;/PRE&gt;
&lt;P&gt;Note also I use cats(), this is simpler than two bars and strip as it automatically strips the data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is this code supposed to do?&lt;/P&gt;
&lt;PRE&gt;data dtc_p1;
run;&lt;/PRE&gt;
&lt;P&gt;Post something which we can actually run, or the log so we can see what is going on.&amp;nbsp; Post test data in the form of a datastep, not an office attachment.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jun 2018 15:14:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-execute/m-p/471726#M120861</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-06-20T15:14:07Z</dc:date>
    </item>
    <item>
      <title>Re: Call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-execute/m-p/471732#M120864</link>
      <description>&lt;P&gt;HI Reeza,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your reply! I've attached three data sets that are needed for this macro, RS, PE and ALLDTC and the output data set DTC_P1. I just wanted the var to be 'RSDTC' when dates come from RS and var to be 'PEDTC' when dates from PE, but now it's "||NAME||". DTC column in DTC_p1 is exactly what I wanted.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jun 2018 15:28:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-execute/m-p/471732#M120864</guid>
      <dc:creator>fbl204653</dc:creator>
      <dc:date>2018-06-20T15:28:00Z</dc:date>
    </item>
    <item>
      <title>Re: Call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-execute/m-p/471743#M120866</link>
      <description>&lt;P&gt;Hi RW9,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your suggestion! It works after I changed d&lt;SPAN&gt;oube quotes to single quotes even though I'm still confused. Attached please find the snapshop of the output data.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I used the following code to create a blank data set and stack new data with that. Is there a better solution?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data dtc_p1;
run;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jun 2018 15:40:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-execute/m-p/471743#M120866</guid>
      <dc:creator>fbl204653</dc:creator>
      <dc:date>2018-06-20T15:40:00Z</dc:date>
    </item>
    <item>
      <title>Re: Call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-execute/m-p/471746#M120867</link>
      <description>&lt;P&gt;PROC APPEND to append data is faster - it copies data in blocks, not one line at a time like a data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please mark&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt;&amp;nbsp;solution as the answer, not your own post.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jun 2018 15:41:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-execute/m-p/471746#M120867</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-06-20T15:41:29Z</dc:date>
    </item>
    <item>
      <title>Re: Call execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-execute/m-p/471750#M120868</link>
      <description>&lt;P&gt;Thanks Reeza, I misclicked. I will follow your advice to use proc append instead.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jun 2018 15:43:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-execute/m-p/471750#M120868</guid>
      <dc:creator>fbl204653</dc:creator>
      <dc:date>2018-06-20T15:43:34Z</dc:date>
    </item>
  </channel>
</rss>

