<?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 failes in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Call-execute-failes/m-p/61225#M13287</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello again,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;next problem is I pass a filereference in a call execute, but I get an error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I pass for example the fileid and uncomment the first part and comment the second part in the macro then it works!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So i could pass the fileid and get the fileref from dataset files as well, but i would like to pass the fullfilename.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Filepath Looks like: (it works when i just pass that to the macro)&lt;/P&gt;&lt;P&gt;/imc/other/osp/wom/ExportedMeasurements1_data.txt&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro ReadFiles(fullfilename);&lt;BR /&gt;/*&lt;BR /&gt;data test&amp;amp;fileid;&lt;BR /&gt;set files;&lt;BR /&gt;where fileid = &amp;amp;fileid;&lt;BR /&gt;run;&lt;BR /&gt;*/&lt;BR /&gt;%if %sysfunc(fileexist(&amp;amp;fullfilename)) %then %do;&lt;BR /&gt;%put The external file &amp;amp;fullfilename does exist.;&lt;/P&gt;&lt;P&gt;%end;&lt;BR /&gt;%else %do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; %put Error &amp;amp;fullfilename;&lt;BR /&gt;%end;&lt;BR /&gt;%mend;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;format fullfile $200.;&lt;BR /&gt;set files;&lt;BR /&gt;if fullfile ne '' then call execute ("%ReadFiles("||trim(fullfile)||");");&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i also tried with strip and compress but always get this kind of error:&lt;/P&gt;&lt;P&gt;Error "||trim(fullfile)||" (so it does not existis and it prints Error &amp;amp;fullfilename&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 07 Sep 2011 07:19:57 GMT</pubDate>
    <dc:creator>Filipvdr</dc:creator>
    <dc:date>2011-09-07T07:19:57Z</dc:date>
    <item>
      <title>Call execute failes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-execute-failes/m-p/61225#M13287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello again,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;next problem is I pass a filereference in a call execute, but I get an error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I pass for example the fileid and uncomment the first part and comment the second part in the macro then it works!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So i could pass the fileid and get the fileref from dataset files as well, but i would like to pass the fullfilename.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Filepath Looks like: (it works when i just pass that to the macro)&lt;/P&gt;&lt;P&gt;/imc/other/osp/wom/ExportedMeasurements1_data.txt&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro ReadFiles(fullfilename);&lt;BR /&gt;/*&lt;BR /&gt;data test&amp;amp;fileid;&lt;BR /&gt;set files;&lt;BR /&gt;where fileid = &amp;amp;fileid;&lt;BR /&gt;run;&lt;BR /&gt;*/&lt;BR /&gt;%if %sysfunc(fileexist(&amp;amp;fullfilename)) %then %do;&lt;BR /&gt;%put The external file &amp;amp;fullfilename does exist.;&lt;/P&gt;&lt;P&gt;%end;&lt;BR /&gt;%else %do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; %put Error &amp;amp;fullfilename;&lt;BR /&gt;%end;&lt;BR /&gt;%mend;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;format fullfile $200.;&lt;BR /&gt;set files;&lt;BR /&gt;if fullfile ne '' then call execute ("%ReadFiles("||trim(fullfile)||");");&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i also tried with strip and compress but always get this kind of error:&lt;/P&gt;&lt;P&gt;Error "||trim(fullfile)||" (so it does not existis and it prints Error &amp;amp;fullfilename&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Sep 2011 07:19:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-execute-failes/m-p/61225#M13287</guid>
      <dc:creator>Filipvdr</dc:creator>
      <dc:date>2011-09-07T07:19:57Z</dc:date>
    </item>
    <item>
      <title>Call execute failes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-execute-failes/m-p/61226#M13288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is just a guess but try putting '%ReadFiles(' in single quotes.&amp;nbsp; My guess is %ReadFiles is getting expanded during the compilation of the data step, and the resolved code is getting call executed.&amp;nbsp; You want to mask the expansion of %ReadFiles, so it is just a macro code with your desired parameter when call executed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HTH...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Sep 2011 12:46:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-execute-failes/m-p/61226#M13288</guid>
      <dc:creator>ScottBass</dc:creator>
      <dc:date>2011-09-07T12:46:04Z</dc:date>
    </item>
    <item>
      <title>Call execute failes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-execute-failes/m-p/61227#M13289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN&gt;Was going to suggest the same thing.&amp;nbsp; The online documention explaines the difference: &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a000543697.htm"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a000543697.htm&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Sep 2011 13:08:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-execute-failes/m-p/61227#M13289</guid>
      <dc:creator>DF</dc:creator>
      <dc:date>2011-09-07T13:08:17Z</dc:date>
    </item>
    <item>
      <title>Call execute failes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-execute-failes/m-p/61228#M13290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Many times perhaps most of the time you will also want to delay execution of the MACRO until after the data step is done using&amp;nbsp;&amp;nbsp; %NRSTR &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: red; font-family: 'Courier New'; background-color: white;"&gt;call&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; execute(&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: purple; font-family: 'Courier New'; background-color: white;"&gt;'%nrstr(%ReadFiles('||trim(fullfile)||'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;));&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: purple; font-family: 'Courier New'; background-color: white;"&gt;');&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Sep 2011 13:13:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-execute-failes/m-p/61228#M13290</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2011-09-07T13:13:29Z</dc:date>
    </item>
    <item>
      <title>Call execute failes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-execute-failes/m-p/61229#M13291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; thanks all for your replies, do any of you guys know of it is possible to call execute from within a macro?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro ReadFiles(fullfilename,name,curve,dark);&lt;BR /&gt;%if "&amp;amp;curve" eq "Y" and "&amp;amp;DARK" eq "N" %then %do;&lt;BR /&gt;proc import datafile=&amp;amp;fullfilename&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; out=&amp;amp;name&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dbms=dlm&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; replace;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; delimiter='09'x;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; datarow=2;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;Proc contents data = &amp;amp;name out = temp_&amp;amp;name varnum;&amp;nbsp;&amp;nbsp; run;&lt;BR /&gt;data temp_&amp;amp;name; &lt;BR /&gt; set temp_&amp;amp;name(keep=name varnum);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sort data=temp_&amp;amp;name;&lt;BR /&gt; by varnum;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data temp_&amp;amp;name;&lt;BR /&gt; set temp_&amp;amp;name;&lt;BR /&gt; if&amp;nbsp; mod(_n_,2) =1 then count+1;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data test_&amp;amp;name;&lt;BR /&gt;set temp_&amp;amp;name;&lt;BR /&gt;by count;&lt;BR /&gt;length list $ 100;&lt;BR /&gt;retain list;&lt;BR /&gt;if first.count then do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; flag+1;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call missing(list);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;BR /&gt; list=catx(' ',list,name);&lt;BR /&gt; A = scan(list,1);&lt;BR /&gt; B = scan(list,2);&lt;BR /&gt;if last.count and B ne '' then do;&lt;BR /&gt;call execute ("%AppendCurve("||strip(flag)||","||strip(A)||","||strip(B)||","||strip(list)||");");&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;%end;&lt;BR /&gt;%if "&amp;amp;curve" eq "N" and "&amp;amp;DARK" eq "N" %then %do;&lt;BR /&gt;proc import datafile=&amp;amp;fullfilename&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; out=&amp;amp;name&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dbms=dlm&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; replace;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; delimiter='09'x;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; datarow=3;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data &amp;amp;name( drop=Run_Id Device rename=(VAR25=Slope_Voc));&lt;BR /&gt; format Curve_Id;&lt;BR /&gt; set &amp;amp;name;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc append base=Edc_wacom data=&amp;amp;name force; run;&lt;/P&gt;&lt;P&gt;data edc_wacom;&lt;BR /&gt; set edc_wacom;&lt;BR /&gt; Curve_id = _N_;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;%end;&lt;BR /&gt;%mend;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Sep 2011 13:49:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-execute-failes/m-p/61229#M13291</guid>
      <dc:creator>Filipvdr</dc:creator>
      <dc:date>2011-09-07T13:49:25Z</dc:date>
    </item>
    <item>
      <title>Re: Call execute failes</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Call-execute-failes/m-p/61230#M13292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you're asking what wrong with this macro it's the same thing double quotes. Plus you probably want %NRSTR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;call execute ('%NRSTR(%AppendCurve('||strip(flag)||","||strip(A)||","||strip(B)||","||strip(list)||"));"); &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Sep 2011 14:26:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Call-execute-failes/m-p/61230#M13292</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2011-09-07T14:26:40Z</dc:date>
    </item>
  </channel>
</rss>

