<?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: Help with Macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Help-with-Macro/m-p/21771#M3503</link>
    <description>I don't really see a macro being necessary to accomplish this task.&lt;BR /&gt;
&lt;BR /&gt;
data emp_new;&lt;BR /&gt;
 set emp end=eof;&lt;BR /&gt;
 if eof=1 then do;&lt;BR /&gt;
  emp_cnt=_N_;&lt;BR /&gt;
  call symput('emp_cnt',emp_cnt);&lt;BR /&gt;
  keep emp_cnt;&lt;BR /&gt;
  output;&lt;BR /&gt;
 end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
The above should create dataset emp_new containing one column (emp_cnt) and one row containing the count of rows in emp, while also putting the count into variable &amp;amp;emp_cnt.  Above is untested but assumed to work.

Message was edited by: mkastin</description>
    <pubDate>Thu, 03 Mar 2011 21:55:25 GMT</pubDate>
    <dc:creator>FriedEgg</dc:creator>
    <dc:date>2011-03-03T21:55:25Z</dc:date>
    <item>
      <title>Help with Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-Macro/m-p/21768#M3500</link>
      <description>Hi, &lt;BR /&gt;
&lt;BR /&gt;
Currently, I am having two proc sql statement where one get's the count of the data and the other sql query creates a new table based on that count. I am trying to create a macro as both the query as same but not able to figure how can I achieve both results? &lt;BR /&gt;
&lt;BR /&gt;
Any suggestions would be highly appreciated.</description>
      <pubDate>Thu, 03 Mar 2011 21:20:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-Macro/m-p/21768#M3500</guid>
      <dc:creator>Pritish</dc:creator>
      <dc:date>2011-03-03T21:20:43Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-Macro/m-p/21769#M3501</link>
      <description>Hello Pritish,&lt;BR /&gt;
&lt;BR /&gt;
If you would like a detailed answer, please give an example of data, desired result and your code.&lt;BR /&gt;
&lt;BR /&gt;
Sincerely,&lt;BR /&gt;
SPR</description>
      <pubDate>Thu, 03 Mar 2011 21:42:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-Macro/m-p/21769#M3501</guid>
      <dc:creator>SPR</dc:creator>
      <dc:date>2011-03-03T21:42:44Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-Macro/m-p/21770#M3502</link>
      <description>1.&lt;BR /&gt;
proc sql;&lt;BR /&gt;
select count (distinct emp) into: emp_cnt&lt;BR /&gt;
from emp; &lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
2. &lt;BR /&gt;
proc sql;&lt;BR /&gt;
create table emp_new as &lt;BR /&gt;
select count (distinct emp) as emp_cnt&lt;BR /&gt;
from emp;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I have this two queries. I want to avoid unnecessary code so trying to go for Macro.

Message was edited by: Pritish</description>
      <pubDate>Thu, 03 Mar 2011 21:52:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-Macro/m-p/21770#M3502</guid>
      <dc:creator>Pritish</dc:creator>
      <dc:date>2011-03-03T21:52:04Z</dc:date>
    </item>
    <item>
      <title>Re: Help with Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-with-Macro/m-p/21771#M3503</link>
      <description>I don't really see a macro being necessary to accomplish this task.&lt;BR /&gt;
&lt;BR /&gt;
data emp_new;&lt;BR /&gt;
 set emp end=eof;&lt;BR /&gt;
 if eof=1 then do;&lt;BR /&gt;
  emp_cnt=_N_;&lt;BR /&gt;
  call symput('emp_cnt',emp_cnt);&lt;BR /&gt;
  keep emp_cnt;&lt;BR /&gt;
  output;&lt;BR /&gt;
 end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
The above should create dataset emp_new containing one column (emp_cnt) and one row containing the count of rows in emp, while also putting the count into variable &amp;amp;emp_cnt.  Above is untested but assumed to work.

Message was edited by: mkastin</description>
      <pubDate>Thu, 03 Mar 2011 21:55:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-with-Macro/m-p/21771#M3503</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2011-03-03T21:55:25Z</dc:date>
    </item>
  </channel>
</rss>

