<?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 type of parameters passed to macro function in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/type-of-parameters-passed-to-macro-function/m-p/177496#M33941</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all:&lt;/P&gt;&lt;P&gt;&amp;nbsp; I need a macro with the functionality to accept both numeric and list as parameters. What I need is sth. like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro check(value, var);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %if &amp;amp;value is list %then %do ......&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %if &amp;amp;value is a single number %then %do ......&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so I can call the macro function either &lt;/P&gt;&lt;P&gt;%check(10,measure);&lt;/P&gt;&lt;P&gt;%check((1,2,3,4,5), measure);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestion on this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 11 Apr 2014 19:58:01 GMT</pubDate>
    <dc:creator>Peter_Y</dc:creator>
    <dc:date>2014-04-11T19:58:01Z</dc:date>
    <item>
      <title>type of parameters passed to macro function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/type-of-parameters-passed-to-macro-function/m-p/177496#M33941</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all:&lt;/P&gt;&lt;P&gt;&amp;nbsp; I need a macro with the functionality to accept both numeric and list as parameters. What I need is sth. like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro check(value, var);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %if &amp;amp;value is list %then %do ......&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %if &amp;amp;value is a single number %then %do ......&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so I can call the macro function either &lt;/P&gt;&lt;P&gt;%check(10,measure);&lt;/P&gt;&lt;P&gt;%check((1,2,3,4,5), measure);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestion on this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Apr 2014 19:58:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/type-of-parameters-passed-to-macro-function/m-p/177496#M33941</guid>
      <dc:creator>Peter_Y</dc:creator>
      <dc:date>2014-04-11T19:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: type of parameters passed to macro function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/type-of-parameters-passed-to-macro-function/m-p/177497#M33942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe I took your question too simple, isn't just adding a quote?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro test (VALUE,measure);&lt;/P&gt;&lt;P&gt;&amp;nbsp; %if &amp;amp;value="1,2,3" %then %put &amp;amp;MEASURE.;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%test("1,2,3",SUCCESS!);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Apr 2014 20:37:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/type-of-parameters-passed-to-macro-function/m-p/177497#M33942</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2014-04-11T20:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: type of parameters passed to macro function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/type-of-parameters-passed-to-macro-function/m-p/177498#M33943</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is my try&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;data have&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;do measure=1 to 10;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;output;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;%macro check(value, var);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;proc means data=have (where=(&amp;amp;var in (&amp;amp;value)));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; var &amp;amp;var;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;%mend;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;%check (10,measure);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;%check (7 8 9,measure);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Apr 2014 20:54:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/type-of-parameters-passed-to-macro-function/m-p/177498#M33943</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-04-11T20:54:11Z</dc:date>
    </item>
    <item>
      <title>Re: type of parameters passed to macro function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/type-of-parameters-passed-to-macro-function/m-p/177499#M33944</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use IN in macro . details check documentation. I can't remember too much.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%macro check(value, list)/mindelimiter=, ;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp; %if &amp;amp;value in &amp;amp;list %then %do ......&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 12 Apr 2014 01:44:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/type-of-parameters-passed-to-macro-function/m-p/177499#M33944</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-04-12T01:44:27Z</dc:date>
    </item>
    <item>
      <title>Re: type of parameters passed to macro function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/type-of-parameters-passed-to-macro-function/m-p/177500#M33945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just use spaces as the delimiter in the value of the parameter.&amp;nbsp; If you need commas in the code that the macro is generating you always put them in later.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%check(10,measure);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%check(1 2 3 4 5, measure);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%macro check(value, var);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; %if %sysfunc(countw(&amp;amp;value,%str( )) &amp;gt; 1 %then %do; ... %end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; %else %do;&amp;nbsp; ...... %end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%mend;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 12 Apr 2014 02:35:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/type-of-parameters-passed-to-macro-function/m-p/177500#M33945</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-04-12T02:35:48Z</dc:date>
    </item>
    <item>
      <title>Re: type of parameters passed to macro function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/type-of-parameters-passed-to-macro-function/m-p/177501#M33946</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just to note on the above very good examples, there is one element of macro functionality which does come up much.&amp;nbsp; It is described in this article: &lt;A href="http://www.lexjansen.com/pharmasug/2006/technicaltechniques/tt28.pdf" title="http://www.lexjansen.com/pharmasug/2006/technicaltechniques/tt28.pdf"&gt;http://www.lexjansen.com/pharmasug/2006/technicaltechniques/tt28.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;So you could change your macro slightly to:&lt;/P&gt;&lt;P&gt;%macro check (var) / pbuff;&lt;/P&gt;&lt;P&gt;Then scan the syspbuff variable.&amp;nbsp; Just another option.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Apr 2014 10:15:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/type-of-parameters-passed-to-macro-function/m-p/177501#M33946</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-04-14T10:15:34Z</dc:date>
    </item>
  </channel>
</rss>

