<?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: macro problem in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/macro-problem/m-p/423712#M104232</link>
    <description>&lt;P&gt;Given that &amp;amp;VAR is ACCTAGE, and given that you want to compare to the macro variable (not the DATA step variable) &amp;amp;ACCTAGE_99, you will need a slightly different expression:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if &amp;amp;var &amp;lt; &amp;amp;&amp;amp;&amp;amp;var._99 then &amp;amp;var = &amp;amp;&amp;amp;&amp;amp;var._99;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The three pieces within &amp;amp;&amp;amp;&amp;amp;var._99 are:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;amp;&amp;amp; ==&amp;gt; &amp;amp;&lt;/P&gt;
&lt;P&gt;&amp;amp;var. ==&amp;gt; Acctage&lt;/P&gt;
&lt;P&gt;_99 ==&amp;gt; _99&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So the whole thing resolves properly into &amp;amp;Acctage_99&lt;/P&gt;</description>
    <pubDate>Wed, 27 Dec 2017 11:59:14 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2017-12-27T11:59:14Z</dc:date>
    <item>
      <title>macro problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-problem/m-p/423687#M104224</link>
      <description>&lt;P&gt;%let acctage_99=4567;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro new(var);&lt;/P&gt;&lt;P&gt;data new;&lt;/P&gt;&lt;P&gt;set old;&lt;/P&gt;&lt;P&gt;if &amp;amp;var&amp;lt;&amp;amp;var_99 then &amp;amp;var=&amp;amp;var_99;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%new(Acctage)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the old dataset I am having a variable Acctage which I need to comapre with macro variable(acctage_99) and then assign the value of acctage_99 to variable acctage&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;how can I acheive this through macro&lt;/P&gt;</description>
      <pubDate>Wed, 27 Dec 2017 08:43:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-problem/m-p/423687#M104224</guid>
      <dc:creator>Rohit12</dc:creator>
      <dc:date>2017-12-27T08:43:00Z</dc:date>
    </item>
    <item>
      <title>Re: macro problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-problem/m-p/423691#M104226</link>
      <description>&lt;P&gt;you should indicate what error or warning message you're seeing so that people can assist. I think you're missing a period '.' though ie after "&amp;amp;var" as follows: "if &amp;amp;var&amp;lt;&amp;amp;var._99 then &amp;amp;var=&amp;amp;var._99;"&lt;/P&gt;</description>
      <pubDate>Wed, 27 Dec 2017 09:05:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-problem/m-p/423691#M104226</guid>
      <dc:creator>pau13rown</dc:creator>
      <dc:date>2017-12-27T09:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: macro problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-problem/m-p/423696#M104227</link>
      <description>&lt;P&gt;actually i am not getting any error .But mu code is not running what i want&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if &amp;amp;var&amp;lt;&amp;amp;var_99 then &amp;amp;var=&amp;amp;var_99;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;below line resolves into&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if acctage&amp;lt;acctage_99 then acctage=acctage_99&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;there comes a note in the log&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;variable acctage_99 is uninitiliazed which is corect&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;what I want is&amp;nbsp; this&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if acctage&amp;lt; 4567 then acctage=4567&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;thanks&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Dec 2017 09:36:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-problem/m-p/423696#M104227</guid>
      <dc:creator>Rohit12</dc:creator>
      <dc:date>2017-12-27T09:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: macro problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-problem/m-p/423697#M104228</link>
      <description>&lt;P&gt;did you try what i suggested? if it is saying "&lt;SPAN&gt;acctage_99 is uninitiliazed&lt;/SPAN&gt;" in the log then what i suggested is likely the problem&lt;/P&gt;</description>
      <pubDate>Wed, 27 Dec 2017 09:39:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-problem/m-p/423697#M104228</guid>
      <dc:creator>pau13rown</dc:creator>
      <dc:date>2017-12-27T09:39:48Z</dc:date>
    </item>
    <item>
      <title>Re: macro problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-problem/m-p/423702#M104229</link>
      <description>&lt;P&gt;You set acctage_99, but you never use it. I guess it should have been&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if &amp;amp;var. &amp;lt; &amp;amp;&amp;amp;var._99 then &amp;amp;var. = &amp;amp;&amp;amp;var._99;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Even better would be to use the max() function:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&amp;amp;var. = max(&amp;amp;var.,&amp;amp;&amp;amp;var._99);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Dec 2017 10:09:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-problem/m-p/423702#M104229</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-12-27T10:09:41Z</dc:date>
    </item>
    <item>
      <title>Re: macro problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-problem/m-p/423712#M104232</link>
      <description>&lt;P&gt;Given that &amp;amp;VAR is ACCTAGE, and given that you want to compare to the macro variable (not the DATA step variable) &amp;amp;ACCTAGE_99, you will need a slightly different expression:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if &amp;amp;var &amp;lt; &amp;amp;&amp;amp;&amp;amp;var._99 then &amp;amp;var = &amp;amp;&amp;amp;&amp;amp;var._99;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The three pieces within &amp;amp;&amp;amp;&amp;amp;var._99 are:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;amp;&amp;amp; ==&amp;gt; &amp;amp;&lt;/P&gt;
&lt;P&gt;&amp;amp;var. ==&amp;gt; Acctage&lt;/P&gt;
&lt;P&gt;_99 ==&amp;gt; _99&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So the whole thing resolves properly into &amp;amp;Acctage_99&lt;/P&gt;</description>
      <pubDate>Wed, 27 Dec 2017 11:59:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-problem/m-p/423712#M104232</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-12-27T11:59:14Z</dc:date>
    </item>
  </channel>
</rss>

