<?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: how can we select required statement using macro? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-can-we-select-required-statement-using-macro/m-p/154647#M30339</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, the first question is this.&amp;nbsp; Do you know how to write a macro (including %macro and %mend statements)?&amp;nbsp; If not, it is up to you to do some basic studying to come up to speed on that topic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once you begin writing a macro, it's pretty simple to check whether a parameter is null or not.&amp;nbsp; Here is the way that I prefer:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%if %length(&amp;amp;exact) %then %do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; exact &amp;amp;exact;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could add similar statements for each of the other parameters.&amp;nbsp; But you do need to know how to write a macro.&amp;nbsp; %IF/%THEN statements are not permitted outside of a macro definition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 03 Nov 2014 19:07:28 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2014-11-03T19:07:28Z</dc:date>
    <item>
      <title>how can we select required statement using macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-can-we-select-required-statement-using-macro/m-p/154646#M30338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to create a macro for proc freq. but the user may use any of the following statement or all of the statement, if they use all the statement then No issue, but if they wish to use only table and weight statement then how can i prevent the other statement where no macro is being passed, to prevent execution&amp;nbsp; (since when an exact or output statement without any variables will through error) ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let Exact= ;&lt;/P&gt;&lt;P&gt;%let TAble= ;&lt;/P&gt;&lt;P&gt;%let output= ;&lt;/P&gt;&lt;P&gt;%let weight =;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc freq data = data1;&lt;/P&gt;&lt;P&gt;Exact &amp;amp;exact;&lt;/P&gt;&lt;P&gt;Table &amp;amp;table;&lt;/P&gt;&lt;P&gt;output &amp;amp;output ;&lt;/P&gt;&lt;P&gt;Weight &amp;amp;weight;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Nov 2014 17:36:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-can-we-select-required-statement-using-macro/m-p/154646#M30338</guid>
      <dc:creator>k26_23</dc:creator>
      <dc:date>2014-11-03T17:36:04Z</dc:date>
    </item>
    <item>
      <title>Re: how can we select required statement using macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-can-we-select-required-statement-using-macro/m-p/154647#M30339</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, the first question is this.&amp;nbsp; Do you know how to write a macro (including %macro and %mend statements)?&amp;nbsp; If not, it is up to you to do some basic studying to come up to speed on that topic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once you begin writing a macro, it's pretty simple to check whether a parameter is null or not.&amp;nbsp; Here is the way that I prefer:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%if %length(&amp;amp;exact) %then %do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; exact &amp;amp;exact;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could add similar statements for each of the other parameters.&amp;nbsp; But you do need to know how to write a macro.&amp;nbsp; %IF/%THEN statements are not permitted outside of a macro definition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Nov 2014 19:07:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-can-we-select-required-statement-using-macro/m-p/154647#M30339</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2014-11-03T19:07:28Z</dc:date>
    </item>
  </channel>
</rss>

