<?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: Macros in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macros/m-p/138266#M27912</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;mr.hai.ko is given the correct&amp;nbsp; stmt in macros&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 13 Jun 2014 05:43:56 GMT</pubDate>
    <dc:creator>avr</dc:creator>
    <dc:date>2014-06-13T05:43:56Z</dc:date>
    <item>
      <title>Macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macros/m-p/138262#M27908</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear SAS Users,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a macro program that follows the basic anatomy of a macro.&amp;nbsp; See sample below, The problem with this one is I can only read in one observation at a time.&amp;nbsp; What is a call routine I can use to automatically bring in a dataset with 10 observations per Var1-Var3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro test (var1, var2, var3) ;&lt;/P&gt;&lt;P&gt;data sample;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var1_new=&amp;amp;var1+&amp;amp;var2;&lt;/P&gt;&lt;P&gt;var2_new=&amp;amp;var2+&amp;amp;var3;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%mend&amp;nbsp; test;&lt;/P&gt;&lt;P&gt;%test (1,2,3);&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>Wed, 11 Jun 2014 17:27:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macros/m-p/138262#M27908</guid>
      <dc:creator>sophia_SAS</dc:creator>
      <dc:date>2014-06-11T17:27:06Z</dc:date>
    </item>
    <item>
      <title>Re: Macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macros/m-p/138263#M27909</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure if I understand what you want, but adding a data step loop x10 will give your 10 obs:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;%macro&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; test (var1, var2, var3);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; data sample;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do _n_=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; to &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;10&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var1_new=&amp;amp;var1+&amp;amp;var2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var2_new=&amp;amp;var2+&amp;amp;var3;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outupt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;%mend&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;%&lt;STRONG&gt;&lt;EM&gt;test&lt;/EM&gt;&lt;/STRONG&gt; (&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;2&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;3&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;Haikuo &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jun 2014 18:18:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macros/m-p/138263#M27909</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2014-06-11T18:18:12Z</dc:date>
    </item>
    <item>
      <title>Re: Macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macros/m-p/138264#M27910</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I should have noted that there are different values for Var1-Var3 and the larger dataset has more than 10 obs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data have;&lt;/P&gt;&lt;P&gt;var1 var2 var3&lt;/P&gt;&lt;P&gt;1 2 3&lt;/P&gt;&lt;P&gt;4 5 6&lt;/P&gt;&lt;P&gt;2 8 2&lt;/P&gt;&lt;P&gt;4 6 3&lt;/P&gt;&lt;P&gt;2 3 5&lt;/P&gt;&lt;P&gt;and so on;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jun 2014 18:22:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macros/m-p/138264#M27910</guid>
      <dc:creator>sophia_SAS</dc:creator>
      <dc:date>2014-06-11T18:22:19Z</dc:date>
    </item>
    <item>
      <title>Re: Macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macros/m-p/138265#M27911</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you do not need a macro and what you need is the following program:&lt;/P&gt;&lt;P&gt;Data have;&lt;BR /&gt;&amp;nbsp; input var1 var2 var3;&lt;BR /&gt;cards;&lt;BR /&gt;1 2 3&lt;BR /&gt;4 5 6&lt;BR /&gt;2 8 2&lt;BR /&gt;4 6 3&lt;BR /&gt;2 3 5&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;&amp;nbsp; set have;&lt;BR /&gt;&amp;nbsp; var1_new=var1+var2;&lt;BR /&gt;&amp;nbsp; var2_new=var2+var3;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jun 2014 18:35:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macros/m-p/138265#M27911</guid>
      <dc:creator>CTorres</dc:creator>
      <dc:date>2014-06-11T18:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: Macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macros/m-p/138266#M27912</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;mr.hai.ko is given the correct&amp;nbsp; stmt in macros&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Jun 2014 05:43:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macros/m-p/138266#M27912</guid>
      <dc:creator>avr</dc:creator>
      <dc:date>2014-06-13T05:43:56Z</dc:date>
    </item>
  </channel>
</rss>

