<?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 Macro in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/70512#M15262</link>
    <description>In a macro, when I use this code&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
proc sql ;&lt;BR /&gt;
select min(score) into: S from test;&lt;BR /&gt;
create table test_ as select *, min(score) as minimum from test;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
select count(*) into: C from test_ where score = minimum;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
data final;&lt;BR /&gt;
set test;&lt;BR /&gt;
%if %eval(&amp;amp;C.)=1 %then %do;&lt;BR /&gt;
%if score=&amp;amp;S %then %let grade=0.80;&lt;BR /&gt;
%else %let grade=0.05;&lt;BR /&gt;
%end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Doesn't throw up error, neither the expected result.&lt;BR /&gt;
&lt;BR /&gt;
Any suggesstions appreciated.&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
    <pubDate>Wed, 09 Feb 2011 13:00:58 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2011-02-09T13:00:58Z</dc:date>
    <item>
      <title>Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/70512#M15262</link>
      <description>In a macro, when I use this code&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
proc sql ;&lt;BR /&gt;
select min(score) into: S from test;&lt;BR /&gt;
create table test_ as select *, min(score) as minimum from test;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
select count(*) into: C from test_ where score = minimum;&lt;BR /&gt;
quit;&lt;BR /&gt;
&lt;BR /&gt;
data final;&lt;BR /&gt;
set test;&lt;BR /&gt;
%if %eval(&amp;amp;C.)=1 %then %do;&lt;BR /&gt;
%if score=&amp;amp;S %then %let grade=0.80;&lt;BR /&gt;
%else %let grade=0.05;&lt;BR /&gt;
%end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Doesn't throw up error, neither the expected result.&lt;BR /&gt;
&lt;BR /&gt;
Any suggesstions appreciated.&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
      <pubDate>Wed, 09 Feb 2011 13:00:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/70512#M15262</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2011-02-09T13:00:58Z</dc:date>
    </item>
    <item>
      <title>Re: Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/70513#M15263</link>
      <description>I see a problem with your data step. &lt;BR /&gt;
&lt;BR /&gt;
Try this...&lt;BR /&gt;
&lt;BR /&gt;
%let s = 20;&lt;BR /&gt;
%let c = 1;&lt;BR /&gt;
&lt;BR /&gt;
data test;&lt;BR /&gt;
	score = 20;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
%macro test;&lt;BR /&gt;
data final;&lt;BR /&gt;
	set test;&lt;BR /&gt;
	%global grade;&lt;BR /&gt;
%if %eval(&amp;amp;C)=1 %then %do;&lt;BR /&gt;
	if score=&amp;amp;S then call symput ('grade','0.80');&lt;BR /&gt;
	else call symput ('grade','0.05');&lt;BR /&gt;
%end;&lt;BR /&gt;
run;&lt;BR /&gt;
%mend test;&lt;BR /&gt;
&lt;BR /&gt;
%test;&lt;BR /&gt;
&lt;BR /&gt;
%put &amp;amp;grade;</description>
      <pubDate>Wed, 09 Feb 2011 16:39:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/70513#M15263</guid>
      <dc:creator>NickR</dc:creator>
      <dc:date>2011-02-09T16:39:58Z</dc:date>
    </item>
    <item>
      <title>Re: Macro</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/70514#M15264</link>
      <description>Nick, thanks for that quick reply.&lt;BR /&gt;
one question, what if my score and grade need to be variables (say with 10 observations) in final dataset?</description>
      <pubDate>Thu, 10 Feb 2011 04:27:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro/m-p/70514#M15264</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2011-02-10T04:27:56Z</dc:date>
    </item>
  </channel>
</rss>

