<?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: Help With Call Execute in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Help-With-Call-Execute/m-p/362028#M85479</link>
    <description>&lt;P&gt;See if nrstr helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;call execute('%nrstr(%_var_desc('||name||');)');&lt;/P&gt;</description>
    <pubDate>Fri, 26 May 2017 16:03:48 GMT</pubDate>
    <dc:creator>WarrenKuhfeld</dc:creator>
    <dc:date>2017-05-26T16:03:48Z</dc:date>
    <item>
      <title>Help With Call Execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-With-Call-Execute/m-p/362023#M85477</link>
      <description>&lt;P&gt;I have the following code::&lt;/P&gt;
&lt;P&gt;*****************************************;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/P&gt;
&lt;P&gt;options obs=max;&lt;BR /&gt;options symbolgen mprint mlogic ;&lt;BR /&gt;%global variable dataset ;&lt;BR /&gt;%macro cont(dataset);&lt;BR /&gt;%global ds;&lt;BR /&gt;%let ds=&amp;amp;dataset.;&lt;BR /&gt;proc contents data=&amp;amp;dataset. noprint out=cont_perf;&lt;BR /&gt;run;&lt;BR /&gt;%mend cont;&lt;BR /&gt;%cont(sashelp.cars);&lt;BR /&gt;%macro condition;&lt;BR /&gt; %if &amp;amp;cnt_nos. &amp;lt;= 10 %then %do;&lt;BR /&gt; %put "cnt less than == 10" ;&lt;BR /&gt; %end;&lt;BR /&gt; %else %do;&lt;BR /&gt; %put "cnt more than == 10" ;&lt;BR /&gt; %end;&lt;BR /&gt;%mend condition;&lt;/P&gt;
&lt;P&gt;%macro _var_desc(variable);&lt;BR /&gt; %global cnt_nos;&lt;BR /&gt; proc sql ;&lt;BR /&gt; select&lt;BR /&gt; cnt into :cnt_nos&lt;BR /&gt; from (&lt;BR /&gt; select &lt;BR /&gt; count(distinct &amp;amp;variable.) as cnt&lt;BR /&gt; from&lt;BR /&gt; &amp;amp;ds.&lt;BR /&gt; )&lt;BR /&gt; ;quit;run;&lt;BR /&gt; %condition;&lt;BR /&gt; %mend _var_desc;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;*****************************************;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Now if i execute it this way it works fine:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;%_var_desc(Cylinders);&lt;BR /&gt;%_var_desc(DriveTrain);&lt;BR /&gt;%_var_desc(EngineSize);&lt;BR /&gt;%_var_desc(Horsepower);&lt;BR /&gt;%_var_desc(Invoice);&lt;BR /&gt;%_var_desc(Length);&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;But if i execute using Call Execute--- It does not got executed correctly. &lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;The macro value does not get refreshed. &lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;I dont know why.&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;BR /&gt; set cont_perf;&lt;BR /&gt; call execute('%_var_desc('||name||');');&lt;BR /&gt; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Please suggest what should I change.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 26 May 2017 15:53:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-With-Call-Execute/m-p/362023#M85477</guid>
      <dc:creator>ArpitSharma</dc:creator>
      <dc:date>2017-05-26T15:53:06Z</dc:date>
    </item>
    <item>
      <title>Re: Help With Call Execute</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-With-Call-Execute/m-p/362028#M85479</link>
      <description>&lt;P&gt;See if nrstr helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;call execute('%nrstr(%_var_desc('||name||');)');&lt;/P&gt;</description>
      <pubDate>Fri, 26 May 2017 16:03:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-With-Call-Execute/m-p/362028#M85479</guid>
      <dc:creator>WarrenKuhfeld</dc:creator>
      <dc:date>2017-05-26T16:03:48Z</dc:date>
    </item>
  </channel>
</rss>

