<?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: calling different dates into one macro variable dynamically one by one in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/calling-different-dates-into-one-macro-variable-dynamically-one/m-p/456306#M14087</link>
    <description>&lt;P&gt;this code not getting.Help&amp;nbsp; me&amp;nbsp;this&amp;nbsp; regard&lt;/P&gt;</description>
    <pubDate>Sun, 22 Apr 2018 16:34:45 GMT</pubDate>
    <dc:creator>rajusas</dc:creator>
    <dc:date>2018-04-22T16:34:45Z</dc:date>
    <item>
      <title>calling different dates into one macro variable dynamically one by one</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/calling-different-dates-into-one-macro-variable-dynamically-one/m-p/456305#M14086</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ds;
format dates date9.;
infile datalines;
input dates date9.;
datalines;
15apr2018
18apr2018
20apr2018
21apr2018
22apr2018
;
run;

data _null_;
set ds;
call symput("dates"||compress(_N_),dates);
run;
%put   &amp;amp;dates1;
%macro tr;
%global x;
%do i=1 %to 5;
x=dates.&amp;amp;i;

%end;

%mend;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 22 Apr 2018 16:31:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/calling-different-dates-into-one-macro-variable-dynamically-one/m-p/456305#M14086</guid>
      <dc:creator>rajusas</dc:creator>
      <dc:date>2018-04-22T16:31:29Z</dc:date>
    </item>
    <item>
      <title>Re: calling different dates into one macro variable dynamically one by one</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/calling-different-dates-into-one-macro-variable-dynamically-one/m-p/456306#M14087</link>
      <description>&lt;P&gt;this code not getting.Help&amp;nbsp; me&amp;nbsp;this&amp;nbsp; regard&lt;/P&gt;</description>
      <pubDate>Sun, 22 Apr 2018 16:34:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/calling-different-dates-into-one-macro-variable-dynamically-one/m-p/456306#M14087</guid>
      <dc:creator>rajusas</dc:creator>
      <dc:date>2018-04-22T16:34:45Z</dc:date>
    </item>
    <item>
      <title>Re: calling different dates into one macro variable dynamically one by one</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/calling-different-dates-into-one-macro-variable-dynamically-one/m-p/456316#M14088</link>
      <description>&lt;P&gt;Check this to add all values into a Macro&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select PUT(dates,date9.) INTO : Dates Separated by " "
from ds;
quit;
%put &amp;amp;Dates;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 22 Apr 2018 17:14:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/calling-different-dates-into-one-macro-variable-dynamically-one/m-p/456316#M14088</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-04-22T17:14:23Z</dc:date>
    </item>
    <item>
      <title>Re: calling different dates into one macro variable dynamically one by one</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/calling-different-dates-into-one-macro-variable-dynamically-one/m-p/456317#M14089</link>
      <description>That gives all dates into one macro variable&lt;BR /&gt;&lt;BR /&gt;I need to use this variable into another macro&lt;BR /&gt;Every date wise it has to run one by one</description>
      <pubDate>Sun, 22 Apr 2018 17:19:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/calling-different-dates-into-one-macro-variable-dynamically-one/m-p/456317#M14089</guid>
      <dc:creator>rajusas</dc:creator>
      <dc:date>2018-04-22T17:19:18Z</dc:date>
    </item>
    <item>
      <title>Re: calling different dates into one macro variable dynamically one by one</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/calling-different-dates-into-one-macro-variable-dynamically-one/m-p/456318#M14090</link>
      <description>&lt;P&gt;A statement like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;a=20apr2018;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is not valid in open code, and not valid (illegal name on the right side) in a data step anyway.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(This is one of the 5 statements created by the macro)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Correction: since you use a numeric format in the input, you get 5 statements&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;a=20000;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(numbers vary).&lt;/P&gt;
&lt;P&gt;As mentioned, such statements are not valid in open code. They would be valid in a data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second correction after running that code on a SAS system:&lt;/P&gt;
&lt;P&gt;Since you do not adress your macro variables correctly, this is the result of calling the macro:&lt;/P&gt;
&lt;PRE&gt;54         %tr
NOTE: Line generated by the invoked macro "TR".
54           x=dates.&amp;amp;i;
             _
             180

ERROR 180-322: Statement is not valid or it is used out of proper order.

NOTE: Line generated by the invoked macro "TR".
54          x=dates.&amp;amp;i;
            _
            180

ERROR 180-322: Statement is not valid or it is used out of proper order.

NOTE: Line generated by the invoked macro "TR".
54          x=dates.&amp;amp;i;
            _
            180

ERROR 180-322: Statement is not valid or it is used out of proper order.

NOTE: Line generated by the invoked macro "TR".
54          x=dates.&amp;amp;i;
            _
            180

ERROR 180-322: Statement is not valid or it is used out of proper order.

NOTE: Line generated by the invoked macro "TR".
54          x=dates.&amp;amp;i;
            _
            180

ERROR 180-322: Statement is not valid or it is used out of proper order.
&lt;/PRE&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/197817"&gt;@rajusas&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ds;
format dates date9.;
infile datalines;
input dates date9.;
datalines;
15apr2018
18apr2018
20apr2018
21apr2018
22apr2018
;
run;

data _null_;
set ds;
call symput("dates"||compress(_N_),dates);
run;
%put   &amp;amp;dates1;
%macro tr;
%global x;
%do i=1 %to 5;
x=dates.&amp;amp;i;

%end;

%mend;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Apr 2018 05:20:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/calling-different-dates-into-one-macro-variable-dynamically-one/m-p/456318#M14090</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-04-23T05:20:49Z</dc:date>
    </item>
    <item>
      <title>Re: calling different dates into one macro variable dynamically one by one</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/calling-different-dates-into-one-macro-variable-dynamically-one/m-p/456319#M14091</link>
      <description>In data it is yymmdd format</description>
      <pubDate>Sun, 22 Apr 2018 17:23:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/calling-different-dates-into-one-macro-variable-dynamically-one/m-p/456319#M14091</guid>
      <dc:creator>rajusas</dc:creator>
      <dc:date>2018-04-22T17:23:18Z</dc:date>
    </item>
    <item>
      <title>Re: calling different dates into one macro variable dynamically one by one</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/calling-different-dates-into-one-macro-variable-dynamically-one/m-p/456320#M14092</link>
      <description>&lt;P&gt;Look at CALL EXECUTE instead then.&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/197817"&gt;@rajusas&lt;/a&gt; wrote:&lt;BR /&gt;That gives all dates into one macro variable&lt;BR /&gt;&lt;BR /&gt;I need to use this variable into another macro&lt;BR /&gt;Every date wise it has to run one by one&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 22 Apr 2018 17:24:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/calling-different-dates-into-one-macro-variable-dynamically-one/m-p/456320#M14092</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-22T17:24:46Z</dc:date>
    </item>
    <item>
      <title>Re: calling different dates into one macro variable dynamically one by one</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/calling-different-dates-into-one-macro-variable-dynamically-one/m-p/456321#M14093</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/197817"&gt;@rajusas&lt;/a&gt; wrote:&lt;BR /&gt;In data it is yymmdd format&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;No. You never assign or otherwise use that format in your code.&lt;/P&gt;</description>
      <pubDate>Sun, 22 Apr 2018 17:26:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/calling-different-dates-into-one-macro-variable-dynamically-one/m-p/456321#M14093</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-04-22T17:26:29Z</dc:date>
    </item>
    <item>
      <title>Re: calling different dates into one macro variable dynamically one by one</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/calling-different-dates-into-one-macro-variable-dynamically-one/m-p/456322#M14094</link>
      <description>&lt;P&gt;Check this then,&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select PUT(dates,date9.),count(*) INTO : Dates Separated by " ",:Count
from ds;
quit;
%put &amp;amp;Dates &amp;amp;Count;

data want;
do i=1 to &amp;amp;Count.;
Date=SCAN("&amp;amp;Dates.",i," ");
output;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 22 Apr 2018 17:37:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/calling-different-dates-into-one-macro-variable-dynamically-one/m-p/456322#M14094</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-04-22T17:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: calling different dates into one macro variable dynamically one by one</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/calling-different-dates-into-one-macro-variable-dynamically-one/m-p/456326#M14095</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ds;
format dates date9.;
infile datalines;
input dates date9.;
datalines;
15apr2018
18apr2018
20apr2018
21apr2018
22apr2018
;
run;

%macro print_date(date=);

%put The Date is: %sysfunc(putn("&amp;amp;date."d, yymmddd10.));
%put The day after the date is: %sysfunc(intnx(day, "&amp;amp;date"d, 1, s), yymmddd10.);

%mend;

data _null_;
set ds;

str = catt('%print_date(date=', 
            put(dates, date9.), 
            ');');
            
call execute (str);
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 22 Apr 2018 19:27:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/calling-different-dates-into-one-macro-variable-dynamically-one/m-p/456326#M14095</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-22T19:27:34Z</dc:date>
    </item>
    <item>
      <title>Re: calling different dates into one macro variable dynamically one by one</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/calling-different-dates-into-one-macro-variable-dynamically-one/m-p/456332#M14096</link>
      <description>&lt;P&gt;Given your original program, the simplest fix would be to change this statement:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;x=dates.&amp;amp;i;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Turn that into:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let x = &amp;amp;&amp;amp;dates&amp;amp;i;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then immediately (don't wait until after the %DO loop, and certainly don't wait for a different macro) add the macro call that should run for each date, referring to &amp;amp;X as needed.&lt;/P&gt;</description>
      <pubDate>Sun, 22 Apr 2018 20:42:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/calling-different-dates-into-one-macro-variable-dynamically-one/m-p/456332#M14096</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-04-22T20:42:32Z</dc:date>
    </item>
  </channel>
</rss>

