<?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 varlist macro varaible with dates in 2 /5/10/15/20/25 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/create-varlist-macro-varaible-with-dates-in-2-5-10-15-20-25/m-p/614553#M179680</link>
    <description>&lt;P&gt;I'd take this approach:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
format mydate date9.;
do i='14AUG2019'd to '16SEP2019'd;
	mydate=i;
	if day(mydate) in (2,5,10,15,20,25) then output;
end;
drop i;
run;

proc sql noprint;
select "'"||put(mydate,date9.)||"'d" into :maclist1 separated by "+"
from want
;quit;

%put &amp;amp;maclist1;

proc sql noprint;
select put(mydate,yymmn6.) into :maclist2 separated by "+"
from want
;quit;

%put &amp;amp;maclist2;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 31 Dec 2019 14:13:59 GMT</pubDate>
    <dc:creator>unison</dc:creator>
    <dc:date>2019-12-31T14:13:59Z</dc:date>
    <item>
      <title>create varlist macro varaible with dates in 2 /5/10/15/20/25</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-varlist-macro-varaible-with-dates-in-2-5-10-15-20-25/m-p/614547#M179675</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I have to following problem.&lt;/P&gt;
&lt;P&gt;User define 2 parameters:&lt;/P&gt;
&lt;P&gt;%let From='14AUG2019'd;&lt;/P&gt;
&lt;P&gt;%let Until='16SEP2019'd;&lt;/P&gt;
&lt;P&gt;The&amp;nbsp; task is to create another macro variable that will include all dates between &amp;amp;FROM&amp;nbsp; and &amp;amp;until&amp;nbsp; but only 2,5,10,15,20,25 dates.&lt;/P&gt;
&lt;P&gt;So in this example a new Varlist macro variable will be created with values:&lt;/P&gt;
&lt;P&gt;'15AUG2019'd+'20AUG2019'd+'25AUG2019'd+'02SEP2019'd+'05SEP2019'd+'10SEP2019'd+'15SEP2019'd;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another Example:&lt;/P&gt;
&lt;P&gt;%let From='24OCT2019'd;&lt;BR /&gt;%let Until='17NOV2019'd;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;So in this example a new Varlist macro variable will be created with values:&lt;BR /&gt;'25OCT2019'd+'02NOV2019'd+'05NOV2019'd+'10NOV2019'd+'15NOV2019'd;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then I have another task:&lt;/P&gt;
&lt;P&gt;How should I transform value to YYMMDD6&amp;nbsp; structure&lt;/P&gt;
&lt;P&gt;'15AUG2019'd+'20AUG2019'd+'25AUG2019'd+'02SEP2019'd+'05SEP2019'd+'10SEP2019'd+'15SEP2019'd;&lt;/P&gt;
&lt;P&gt;will be transformed to&amp;nbsp;&lt;/P&gt;
&lt;P&gt;190815+190820+190825+190902+190905+190910+190915;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Dec 2019 13:18:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-varlist-macro-varaible-with-dates-in-2-5-10-15-20-25/m-p/614547#M179675</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2019-12-31T13:18:27Z</dc:date>
    </item>
    <item>
      <title>Re: create varlist macro varaible with dates in 2 /5/10/15/20/25</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-varlist-macro-varaible-with-dates-in-2-5-10-15-20-25/m-p/614552#M179679</link>
      <description>&lt;P&gt;Note that there is a limit to how many characters you can put into a single macro variable.&lt;/P&gt;
&lt;P&gt;It is probably easier to do this in two steps. One to make the list and another to make the macro variable(s).&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let From='24OCT2019'd;
%let Until='17NOV2019'd;

data list ;
  do date=&amp;amp;from to &amp;amp;until ;
    if day(date) in (2 5 10 15 20 25) then output;
  end;
run;

proc sql noprint;
  select cats(quote(put(date,date9.)),'d') 
       , put(date,yymmdd6.)
    into :varlist1 separated by '+'
       , :varlist2 separated by '+'
    from list
  ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;398   %put &amp;amp;=varlist1;
VARLIST1="25OCT2019"d+"02NOV2019"d+"05NOV2019"d+"10NOV2019"d+"15NOV2019"d
399   %put &amp;amp;=varlist2;
VARLIST2=191025+191102+191105+191110+191115
&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 Dec 2019 14:08:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-varlist-macro-varaible-with-dates-in-2-5-10-15-20-25/m-p/614552#M179679</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-12-31T14:08:55Z</dc:date>
    </item>
    <item>
      <title>Re: create varlist macro varaible with dates in 2 /5/10/15/20/25</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-varlist-macro-varaible-with-dates-in-2-5-10-15-20-25/m-p/614553#M179680</link>
      <description>&lt;P&gt;I'd take this approach:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
format mydate date9.;
do i='14AUG2019'd to '16SEP2019'd;
	mydate=i;
	if day(mydate) in (2,5,10,15,20,25) then output;
end;
drop i;
run;

proc sql noprint;
select "'"||put(mydate,date9.)||"'d" into :maclist1 separated by "+"
from want
;quit;

%put &amp;amp;maclist1;

proc sql noprint;
select put(mydate,yymmn6.) into :maclist2 separated by "+"
from want
;quit;

%put &amp;amp;maclist2;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 Dec 2019 14:13:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-varlist-macro-varaible-with-dates-in-2-5-10-15-20-25/m-p/614553#M179680</guid>
      <dc:creator>unison</dc:creator>
      <dc:date>2019-12-31T14:13:59Z</dc:date>
    </item>
    <item>
      <title>Re: create varlist macro varaible with dates in 2 /5/10/15/20/25</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-varlist-macro-varaible-with-dates-in-2-5-10-15-20-25/m-p/614556#M179683</link>
      <description>&lt;P&gt;You are the best!&lt;/P&gt;</description>
      <pubDate>Tue, 31 Dec 2019 14:46:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-varlist-macro-varaible-with-dates-in-2-5-10-15-20-25/m-p/614556#M179683</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2019-12-31T14:46:50Z</dc:date>
    </item>
  </channel>
</rss>

