<?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 data help new user in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/macro-data-help-new-user/m-p/573782#M12569</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You cannot reference a macro variable in the usual way in a data step that is created by this data step.&lt;/P&gt;
&lt;P&gt;"&amp;amp;" references are resolved at data step &lt;EM&gt;compile&lt;/EM&gt; time, while call symput works at data step &lt;EM&gt;run&lt;/EM&gt; time.&lt;/P&gt;
&lt;P&gt;Simplify your code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
mthid1 = intck('month','01jan1990'd,today());
put mthid1=;
mthid3 = mthid1 - 3;
call symputx('mthid1',mthid1);
call symputx('mthid3',mthid3);
run;
%put mthid1=&amp;amp;mthid1;
%put mthid3=&amp;amp;mthid3;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 16 Jul 2019 09:08:18 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2019-07-16T09:08:18Z</dc:date>
    <item>
      <title>macro data help new user</title>
      <link>https://communities.sas.com/t5/New-SAS-User/macro-data-help-new-user/m-p/573780#M12568</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like some help please&lt;/P&gt;&lt;P&gt;I have this peace of code which gives me a result of 354 for MONTHID1 ,&amp;nbsp; I don't know too much about macro so how do I get a new macro called month_id3&amp;nbsp; that results in 351 using MONTHID 1 , I have tried this&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;%let today=%sysfunc(today());&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;mthid1=intck('month','01jan1990'd,&amp;amp;today.)+1-1;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;call symput('MONTHID1',put(mthid1,3.));&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;%let month_id = %str(%')&amp;amp;MONTHID1.%str(%');/*'354';*/&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;%let month_id3 = '(&amp;amp;MONTHID1.-3)';&amp;nbsp; &amp;nbsp;/* this doesn't work)&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;%put &amp;amp;month_id ***&amp;amp;month_id3***;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Many thanks&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 16 Jul 2019 08:59:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/macro-data-help-new-user/m-p/573780#M12568</guid>
      <dc:creator>jorquec</dc:creator>
      <dc:date>2019-07-16T08:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: macro data help new user</title>
      <link>https://communities.sas.com/t5/New-SAS-User/macro-data-help-new-user/m-p/573782#M12569</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You cannot reference a macro variable in the usual way in a data step that is created by this data step.&lt;/P&gt;
&lt;P&gt;"&amp;amp;" references are resolved at data step &lt;EM&gt;compile&lt;/EM&gt; time, while call symput works at data step &lt;EM&gt;run&lt;/EM&gt; time.&lt;/P&gt;
&lt;P&gt;Simplify your code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
mthid1 = intck('month','01jan1990'd,today());
put mthid1=;
mthid3 = mthid1 - 3;
call symputx('mthid1',mthid1);
call symputx('mthid3',mthid3);
run;
%put mthid1=&amp;amp;mthid1;
%put mthid3=&amp;amp;mthid3;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Jul 2019 09:08:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/macro-data-help-new-user/m-p/573782#M12569</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-16T09:08:18Z</dc:date>
    </item>
    <item>
      <title>Re: macro data help new user</title>
      <link>https://communities.sas.com/t5/New-SAS-User/macro-data-help-new-user/m-p/573793#M12576</link>
      <description>&lt;P&gt;In addition to &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt; excellent adivce, you generally do not want macro variables to have values that begins with a quote and ends with a quote, as in your example the macro variable has a value of '354'. This is really only making your life difficult, you cannot (easily) perform arithmetic on macro variables that have quotes to begin and end the value of the macro variable; and probably best to be avoided. For clarity, the code from Kurt Bremser produces macro variables whose value are 354 and 351, with no quotes, and the subtraction of 3 from 354 is simple.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2019 11:33:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/macro-data-help-new-user/m-p/573793#M12576</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-07-16T11:33:27Z</dc:date>
    </item>
    <item>
      <title>Re: macro data help new user</title>
      <link>https://communities.sas.com/t5/New-SAS-User/macro-data-help-new-user/m-p/573797#M12578</link>
      <description>&lt;P&gt;Many thanks. It was very helpful.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2019 11:04:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/macro-data-help-new-user/m-p/573797#M12578</guid>
      <dc:creator>jorquec</dc:creator>
      <dc:date>2019-07-16T11:04:03Z</dc:date>
    </item>
  </channel>
</rss>

