<?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: If Then Run PROC in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/If-Then-Run-PROC/m-p/195498#M36796</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;see also:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sascommunity.org/wiki/Using_Functions_SYSFUNC_and_IFC_to_conditionally_execute_statements_in_open_code" title="http://www.sascommunity.org/wiki/Using_Functions_SYSFUNC_and_IFC_to_conditionally_execute_statements_in_open_code"&gt;Using Functions SYSFUNC and IFC to conditionally execute statements in open code - sasCommunity&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let fmt_catalog = library.formats;&lt;/P&gt;&lt;P&gt;%sysfunc(ifc(%sysfunc(cexist(&amp;amp;fmt_catalog))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,%nrstr(%put exist catalog(&amp;amp;fmt_catalog);)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,%nrstr(%put not exist catalog(&amp;amp;fmt_catalog);),))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;yes, you have to be good at counting parentheses!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ron Fehd&amp;nbsp; there is an easier way&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 29 May 2015 22:17:48 GMT</pubDate>
    <dc:creator>Ron_MacroMaven</dc:creator>
    <dc:date>2015-05-29T22:17:48Z</dc:date>
    <item>
      <title>If Then Run PROC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-Then-Run-PROC/m-p/195495#M36793</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want PROC REG to be run if a condition satisfies. For example, I have a table that stores variable names and variance (VIF). If any variable has variance value greater than 5, i want PROC REG to be run on different dataset (input data set), else exit (out of the macro).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" width="128"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD height="20" width="64"&gt;Variable&lt;/TD&gt;&lt;TD width="64"&gt;Variance&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20"&gt;A&lt;/TD&gt;&lt;TD align="right"&gt;3.75&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20"&gt;B&lt;/TD&gt;&lt;TD align="right"&gt;4.5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20"&gt;C&lt;/TD&gt;&lt;TD align="right"&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20"&gt;D&lt;/TD&gt;&lt;TD align="right"&gt;11&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="20"&gt;E&lt;/TD&gt;&lt;TD align="right"&gt;13&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2015 19:04:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-Then-Run-PROC/m-p/195495#M36793</guid>
      <dc:creator>Ujjawal</dc:creator>
      <dc:date>2015-05-28T19:04:39Z</dc:date>
    </item>
    <item>
      <title>Re: If Then Run PROC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-Then-Run-PROC/m-p/195496#M36794</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since you mention exit a macro then we assume all of this is within a defined macro.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First get a flag value that says you have a variance in the range you are concerned with:&lt;/P&gt;&lt;P&gt;&amp;lt;previous macro code&amp;gt;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select (max(variance)&amp;gt;5) into : varflag&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from have;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;/*The macro variable varflag will be 1 if true. OR you could select the maximum value but you'll need to play some games with %sysevalf in comparisons and this is a tad cleaner;*/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%if &amp;amp;varflag =1 %then %goto leave;&amp;nbsp; /* NOTE there is no % for leave here but is used for the line label to skip to*/&lt;/P&gt;&lt;P&gt;&amp;lt;the code to execute when you aren't going to leave the macro&amp;gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%leave:&amp;nbsp; &amp;lt;any code you might want to execute before leaving the macro could go here such as&lt;/P&gt;&lt;P&gt;cleaning up data sets&amp;gt;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2015 20:54:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-Then-Run-PROC/m-p/195496#M36794</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2015-05-28T20:54:46Z</dc:date>
    </item>
    <item>
      <title>Re: If Then Run PROC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-Then-Run-PROC/m-p/195497#M36795</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a ton. Very Helpful!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 May 2015 21:23:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-Then-Run-PROC/m-p/195497#M36795</guid>
      <dc:creator>Ujjawal</dc:creator>
      <dc:date>2015-05-28T21:23:09Z</dc:date>
    </item>
    <item>
      <title>Re: If Then Run PROC</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-Then-Run-PROC/m-p/195498#M36796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;see also:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.sascommunity.org/wiki/Using_Functions_SYSFUNC_and_IFC_to_conditionally_execute_statements_in_open_code" title="http://www.sascommunity.org/wiki/Using_Functions_SYSFUNC_and_IFC_to_conditionally_execute_statements_in_open_code"&gt;Using Functions SYSFUNC and IFC to conditionally execute statements in open code - sasCommunity&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let fmt_catalog = library.formats;&lt;/P&gt;&lt;P&gt;%sysfunc(ifc(%sysfunc(cexist(&amp;amp;fmt_catalog))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,%nrstr(%put exist catalog(&amp;amp;fmt_catalog);)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ,%nrstr(%put not exist catalog(&amp;amp;fmt_catalog);),))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;yes, you have to be good at counting parentheses!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ron Fehd&amp;nbsp; there is an easier way&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 29 May 2015 22:17:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-Then-Run-PROC/m-p/195498#M36796</guid>
      <dc:creator>Ron_MacroMaven</dc:creator>
      <dc:date>2015-05-29T22:17:48Z</dc:date>
    </item>
  </channel>
</rss>

