<?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: Create a macro value // passing value to macro variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-value-passing-value-to-macro-variable/m-p/415714#M101998</link>
    <description>Thanks a lot.&lt;BR /&gt;HC</description>
    <pubDate>Wed, 22 Nov 2017 23:17:59 GMT</pubDate>
    <dc:creator>hhchenfx</dc:creator>
    <dc:date>2017-11-22T23:17:59Z</dc:date>
    <item>
      <title>Create a macro value // passing value to macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-value-passing-value-to-macro-variable/m-p/415629#M101953</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;
&lt;P&gt;I want to create a macro variable that take the value of today date in the form yyyymmdd.&lt;/P&gt;
&lt;P&gt;I can do it with my code below but I have to start with a dataset "mydata".&lt;/P&gt;
&lt;P&gt;I thought that there should be a way to use _NULL_ data but I cant work it out.&lt;/P&gt;
&lt;P&gt;Can you help me?&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;HC&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*SOLUTION --------------------------------

data _NULL_;
format today yymmdd8.;
today=date(); 
ymd=year(today)*10000+month(today)*100+day(today);

   call symputx('next_month',put(ymd,10.));

run;

%put &amp;amp;next_month;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data TEMP; 		set Mydata;
format today yymmdd8.;
today=date(); 
ymd=year(today)*10000+month(today)*100+day(today);run;

	proc sql;
	select Max(ymd) into:todaydate
	from  TEMP;quit;

	%put &amp;amp;todaydate;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2017 23:19:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-value-passing-value-to-macro-variable/m-p/415629#M101953</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2017-11-22T23:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: Create a macro value // passing value to macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-value-passing-value-to-macro-variable/m-p/415633#M101954</link>
      <description>&lt;P&gt;Look up %SYSFUNC and note the two parameters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let today = %sysfunc(today(), yymmdd8.);

%put &amp;amp;today.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Nov 2017 19:46:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-value-passing-value-to-macro-variable/m-p/415633#M101954</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-11-22T19:46:03Z</dc:date>
    </item>
    <item>
      <title>Re: Create a macro value // passing value to macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-value-passing-value-to-macro-variable/m-p/415644#M101960</link>
      <description>&lt;P&gt;Thank you for the suggestion.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am&amp;nbsp;more concern with manipulating the value a bit before passing it to macro variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HC&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2017 20:17:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-value-passing-value-to-macro-variable/m-p/415644#M101960</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2017-11-22T20:17:37Z</dc:date>
    </item>
    <item>
      <title>Re: Create a macro value // passing value to macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-value-passing-value-to-macro-variable/m-p/415649#M101962</link>
      <description>&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Check out "CALL SYMPUT" which can pass the value to a macro variable with DATA _NULL_&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2017 20:25:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-value-passing-value-to-macro-variable/m-p/415649#M101962</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2017-11-22T20:25:58Z</dc:date>
    </item>
    <item>
      <title>Re: Create a macro value // passing value to macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-value-passing-value-to-macro-variable/m-p/415650#M101963</link>
      <description>&lt;P&gt;I don't really understand what your question is.&lt;/P&gt;
&lt;P&gt;You do not need to have an input dataset to run a data step.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
   x=today();
   next_month=intnx('month',x,1,'b');
   call symputx('next_month',put(next_month,yymmddn8.));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Nov 2017 20:27:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-value-passing-value-to-macro-variable/m-p/415650#M101963</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-11-22T20:27:37Z</dc:date>
    </item>
    <item>
      <title>Re: Create a macro value // passing value to macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-value-passing-value-to-macro-variable/m-p/415714#M101998</link>
      <description>Thanks a lot.&lt;BR /&gt;HC</description>
      <pubDate>Wed, 22 Nov 2017 23:17:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-macro-value-passing-value-to-macro-variable/m-p/415714#M101998</guid>
      <dc:creator>hhchenfx</dc:creator>
      <dc:date>2017-11-22T23:17:59Z</dc:date>
    </item>
  </channel>
</rss>

