<?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: A Macro parameterisation question? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/A-Macro-parameterisation-question/m-p/202095#M266879</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Fabulous Patrick, Thank you so much. Have a great evening! Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 14 Jul 2015 11:21:17 GMT</pubDate>
    <dc:creator>CharlotteCain</dc:creator>
    <dc:date>2015-07-14T11:21:17Z</dc:date>
    <item>
      <title>A Macro parameterisation question?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-Macro-parameterisation-question/m-p/202090#M266874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How do write the macro syntax and logic to parameterise properly for the following need?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro exec(dsn);&lt;/P&gt;&lt;P&gt;data want1;&lt;/P&gt;&lt;P&gt;set &amp;amp;dsn;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;%exec(input_dataset1)&lt;/P&gt;&lt;P&gt;%exec(input_dataset2)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When &amp;amp;dsn resolves to input_dataset1 the program creates want1, and my need is then &amp;amp;dsn resolves to input_dataset2 in the second call execution, i want the output dataset as want2. Please advice and help?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jul 2015 10:33:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-Macro-parameterisation-question/m-p/202090#M266874</guid>
      <dc:creator>CharlotteCain</dc:creator>
      <dc:date>2015-07-14T10:33:08Z</dc:date>
    </item>
    <item>
      <title>Re: A Macro parameterisation question?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-Macro-parameterisation-question/m-p/202091#M266875</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If it doesn't need to be "want" but just data set names with consecutive numbering then you could leave it to SAS using code as below. The resulting data sets would then be called "data1", "data2" and so on.... Would this be sufficient for your purposes?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro exec(dsn);&lt;/P&gt;&lt;P&gt;&amp;nbsp; data;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set &amp;amp;dsn;&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%exec(sashelp.class)&lt;/P&gt;&lt;P&gt;%exec(sashelp.class)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jul 2015 10:44:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-Macro-parameterisation-question/m-p/202091#M266875</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-07-14T10:44:58Z</dc:date>
    </item>
    <item>
      <title>Re: A Macro parameterisation question?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-Macro-parameterisation-question/m-p/202092#M266876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If the informationyou have provided matches, then just drop the naming and use the number:&lt;/P&gt;&lt;P&gt;%macro exec(dsn);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data want&amp;amp;dsn.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set input_dataset&amp;amp;dsn.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;%mend exec;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%exec(dsn=1);&lt;/P&gt;&lt;P&gt;%exec(dsn=2);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There may however be easier ways to achieve what you want depending on what it is your doing.&amp;nbsp; For example, setting your data together, then doing processing, then splitting again:&lt;/P&gt;&lt;P&gt;data inter;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set input_dataset1 (in=a)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input_dataset2 (in=b);&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if a then file=1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if b&amp;nbsp; then file=2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;/* do processing here */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;data want1 want2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set inter;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if file=1 then output want1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else output want2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or maybe you don't need to split them at all (which is generally my preferred option).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jul 2015 10:53:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-Macro-parameterisation-question/m-p/202092#M266876</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-07-14T10:53:38Z</dc:date>
    </item>
    <item>
      <title>Re: A Macro parameterisation question?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-Macro-parameterisation-question/m-p/202093#M266877</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Patrick, I hope you are well. Sun is shining down under? Thank you.I like that and one sweet comment "cheeky" &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt; Well, that will do for my testing purposes. Do you mind helping me with a resolve that will give me the choice to name the datasets?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jul 2015 10:53:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-Macro-parameterisation-question/m-p/202093#M266877</guid>
      <dc:creator>CharlotteCain</dc:creator>
      <dc:date>2015-07-14T10:53:53Z</dc:date>
    </item>
    <item>
      <title>Re: A Macro parameterisation question?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-Macro-parameterisation-question/m-p/202094#M266878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sun is shining but it's cold. Can't wait that Winter is over! Two more months to go.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here a code variant which lets you choose the name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro exec(dsn,dsn_out);&lt;/P&gt;&lt;P&gt;&amp;nbsp; %if &amp;amp;dsn_out= %then %let dsn_out=want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; data;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set &amp;amp;dsn;&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; proc datasets lib=work nolist;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; change %scan(&amp;amp;syslast,-1)=&amp;amp;dsn_out._%sysfunc(compress(%scan(&amp;amp;syslast,-1),,kd));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&amp;nbsp; quit;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%exec(sashelp.class)&lt;/P&gt;&lt;P&gt;%exec(sashelp.class,test)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jul 2015 11:01:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-Macro-parameterisation-question/m-p/202094#M266878</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2015-07-14T11:01:34Z</dc:date>
    </item>
    <item>
      <title>Re: A Macro parameterisation question?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-Macro-parameterisation-question/m-p/202095#M266879</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Fabulous Patrick, Thank you so much. Have a great evening! Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jul 2015 11:21:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-Macro-parameterisation-question/m-p/202095#M266879</guid>
      <dc:creator>CharlotteCain</dc:creator>
      <dc:date>2015-07-14T11:21:17Z</dc:date>
    </item>
    <item>
      <title>Re: A Macro parameterisation question?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/A-Macro-parameterisation-question/m-p/202096#M266880</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you really want the macro to remember the number of times it has been called then you will need to use a global macro variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%macro exec(dsn);&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%global exec_cnt ;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%let exec_cnt=%eval(&amp;amp;exec_cnt+1);&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;data want&amp;amp;exec_cnt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;set &amp;amp;dsn;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;run;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%mend;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 14 Jul 2015 11:49:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/A-Macro-parameterisation-question/m-p/202096#M266880</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-07-14T11:49:28Z</dc:date>
    </item>
  </channel>
</rss>

