<?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? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/macro/m-p/443447#M110944</link>
    <description>Thank you for your explanation ballardw. I understand my mistake and happy with your solution.&lt;BR /&gt;&lt;BR /&gt;thank you</description>
    <pubDate>Wed, 07 Mar 2018 18:33:49 GMT</pubDate>
    <dc:creator>unnati</dc:creator>
    <dc:date>2018-03-07T18:33:49Z</dc:date>
    <item>
      <title>%macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro/m-p/443016#M110803</link>
      <description>&lt;P&gt;Question:- I would like to use Macro and want to create a new variable (i am trying to create&lt;U&gt;&lt;STRONG&gt; age variable form birthday variable&lt;/STRONG&gt;&lt;/U&gt; in dataset(excel file)) . I try to write this code. Can anyone explain what is wrong in this code and why i am not able to use Macro this way.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;1.code 1
data fs;
set bb;
call symput('var',age(int((Today()-birthday)/365.25)));
run;

2. code2

data fs;
set bb;
call symput('var',age(int((&amp;amp;sysdate-birthday)/365.25)));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Mar 2018 19:56:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro/m-p/443016#M110803</guid>
      <dc:creator>unnati</dc:creator>
      <dc:date>2018-03-06T19:56:43Z</dc:date>
    </item>
    <item>
      <title>Re: %macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro/m-p/443026#M110809</link>
      <description>&lt;P&gt;What are you trying to do?&lt;/P&gt;
&lt;P&gt;There's no AGE function so your reference there is incorrect.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/3676"&gt;@unnati&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Question:- I would like to use Macro and want to create a new variable (i am trying to create&lt;U&gt;&lt;STRONG&gt; age variable form birthday variable&lt;/STRONG&gt;&lt;/U&gt; in dataset(excel file)) . I try to write this code. Can anyone explain what is wrong in this code and why i am not able to use Macro this way.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;1.code 1
data fs;
set bb;
call symput('var',age(int((Today()-birthday)/365.25)));
run;

2. code2

data fs;
set bb;
call symput('var',age(int((&amp;amp;sysdate-birthday)/365.25)));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Tue, 06 Mar 2018 20:18:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro/m-p/443026#M110809</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-03-06T20:18:28Z</dc:date>
    </item>
    <item>
      <title>Re: %macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro/m-p/443031#M110811</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/3676"&gt;@unnati&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Question:- I would like to use Macro and want to create a new variable (i am trying to create&lt;U&gt;&lt;STRONG&gt; age variable form birthday variable&lt;/STRONG&gt;&lt;/U&gt; in dataset(excel file)) . I try to write this code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can anyone explain what is wrong in this code and why i am not able to use Macro this way.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Excel files do not show us the actual values in your data variables in the SAS data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Better is to post example data as a data step. Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why do you want a macro variable? How is it going to be used?&lt;/P&gt;
&lt;P&gt;If you want an Age attached to each record in your data there is no reason to use a macro at all.&lt;/P&gt;
&lt;P&gt;You can get the age given two SAS date values using&lt;/P&gt;
&lt;P&gt;Age= yrdif(birthday,today(),'AGE'); which will yield a number of years and a decimal portion.&lt;/P&gt;
&lt;P&gt;If you only want the calendar years then&lt;/P&gt;
&lt;P&gt;Age = floor(yrdif(birthday,today,'AGE'));&lt;/P&gt;
&lt;P&gt;which will discard the decimal portion.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2018 20:23:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro/m-p/443031#M110811</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-03-06T20:23:11Z</dc:date>
    </item>
    <item>
      <title>Re: %macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro/m-p/443447#M110944</link>
      <description>Thank you for your explanation ballardw. I understand my mistake and happy with your solution.&lt;BR /&gt;&lt;BR /&gt;thank you</description>
      <pubDate>Wed, 07 Mar 2018 18:33:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro/m-p/443447#M110944</guid>
      <dc:creator>unnati</dc:creator>
      <dc:date>2018-03-07T18:33:49Z</dc:date>
    </item>
  </channel>
</rss>

