<?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 Create a sas parameter with next 5 months of end of quarter in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Create-a-sas-parameter-with-next-5-months-of-end-of-quarter/m-p/520299#M141055</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I want to ask a question please.&lt;/P&gt;
&lt;P&gt;I have the following situation:&lt;/P&gt;
&lt;P&gt;User define a month in macro parameter (for example 1706 which means June 2017)&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;%let last=1706;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to create a new parameter called vector that will take next 5 months (Each month is end of quarter)&lt;/P&gt;
&lt;P&gt;so in this example&amp;nbsp;vector parameter will get values &amp;nbsp;1709+1712+1803+1806+1809 (with + between the values)&lt;/P&gt;
&lt;P&gt;I can write &amp;nbsp;%let vector=1709+1712+1803+1806+1809;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I want to ask how can it be created automatically ?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I do it please?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 11 Dec 2018 09:28:19 GMT</pubDate>
    <dc:creator>Ronein</dc:creator>
    <dc:date>2018-12-11T09:28:19Z</dc:date>
    <item>
      <title>Create a sas parameter with next 5 months of end of quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-sas-parameter-with-next-5-months-of-end-of-quarter/m-p/520299#M141055</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I want to ask a question please.&lt;/P&gt;
&lt;P&gt;I have the following situation:&lt;/P&gt;
&lt;P&gt;User define a month in macro parameter (for example 1706 which means June 2017)&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;%let last=1706;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to create a new parameter called vector that will take next 5 months (Each month is end of quarter)&lt;/P&gt;
&lt;P&gt;so in this example&amp;nbsp;vector parameter will get values &amp;nbsp;1709+1712+1803+1806+1809 (with + between the values)&lt;/P&gt;
&lt;P&gt;I can write &amp;nbsp;%let vector=1709+1712+1803+1806+1809;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I want to ask how can it be created automatically ?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How can I do it please?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Dec 2018 09:28:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-sas-parameter-with-next-5-months-of-end-of-quarter/m-p/520299#M141055</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2018-12-11T09:28:19Z</dc:date>
    </item>
    <item>
      <title>Re: Create a sas parameter with next 5 months of end of quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-sas-parameter-with-next-5-months-of-end-of-quarter/m-p/520303#M141056</link>
      <description>&lt;P&gt;I succeed to created the 5 dates&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now I need to crerate a sas parameter that contain these values with + between them&lt;/P&gt;
&lt;P&gt;How can I do it please?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;Data a;&lt;BR /&gt; last_help=input("&amp;amp;last.",yymmn4.); &lt;BR /&gt;format last_help yymmn4.;&lt;BR /&gt;/*SAS date of &amp;amp;last. with format YYMM*/&lt;BR /&gt;date1 = intnx('month',last_help,3); &lt;BR /&gt;format date1 yymmn4.; &lt;BR /&gt;date_char1=put(date1,yymmn4.);&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;date2 = intnx('month',last_help,6); &lt;BR /&gt;format date2 yymmn4.; &lt;BR /&gt;date_char2=put(date2,yymmn4.);&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;date3 = intnx('month',last_help,9); &lt;BR /&gt;format date3 yymmn4.; &lt;BR /&gt;date_char3=put(date3,yymmn4.);&lt;/P&gt;
&lt;P&gt;date4 = intnx('month',last_help,12); &lt;BR /&gt;format date4 yymmn4.; &lt;BR /&gt;date_char4=put(date4,yymmn4.);&lt;/P&gt;
&lt;P&gt;date5 = intnx('month',last_help,15); &lt;BR /&gt;format date5 yymmn4.;&lt;BR /&gt;date_char5=put(date5,yymmn4.);&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;call symput("date_char1",trim(left(date_char1)));&lt;BR /&gt;call symput("date_char2",trim(left(date_char2)));&lt;BR /&gt;call symput("date_char3",trim(left(date_char3)));&lt;BR /&gt;call symput("date_char4",trim(left(date_char4)));&lt;BR /&gt;call symput("date_char5",trim(left(date_char5)));&lt;BR /&gt;Run;&lt;BR /&gt;%let vector=&amp;amp;date_char1.+date_char2.+date_char3.+date_char4.+date_char5.;&lt;BR /&gt;%put &amp;amp;vector.;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Dec 2018 09:43:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-sas-parameter-with-next-5-months-of-end-of-quarter/m-p/520303#M141056</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2018-12-11T09:43:02Z</dc:date>
    </item>
    <item>
      <title>Re: Create a sas parameter with next 5 months of end of quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-sas-parameter-with-next-5-months-of-end-of-quarter/m-p/520304#M141057</link>
      <description>&lt;P&gt;First off, why do you want to do this? I can't think of any application where it will be of benefit?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Dec 2018 09:45:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-sas-parameter-with-next-5-months-of-end-of-quarter/m-p/520304#M141057</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-12-11T09:45:04Z</dc:date>
    </item>
    <item>
      <title>Re: Create a sas parameter with next 5 months of end of quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-sas-parameter-with-next-5-months-of-end-of-quarter/m-p/520305#M141058</link>
      <description>&lt;P&gt;Why?&lt;/P&gt;
&lt;P&gt;Because in my work office(insurance company) there is a program where there are 2 user defined parameters:&lt;/P&gt;
&lt;P&gt;First parameter is specific month&lt;/P&gt;
&lt;P&gt;Second parameter is 5 months after this month (in end of quarter)&lt;/P&gt;
&lt;P&gt;My task is to make it more useful that user will define only one parameter &amp;nbsp;and the second parameter will be calculated automatically&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Dec 2018 09:47:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-sas-parameter-with-next-5-months-of-end-of-quarter/m-p/520305#M141058</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2018-12-11T09:47:49Z</dc:date>
    </item>
    <item>
      <title>Re: Create a sas parameter with next 5 months of end of quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-sas-parameter-with-next-5-months-of-end-of-quarter/m-p/520306#M141059</link>
      <description>&lt;P&gt;Now put the repeating code into a do loop.&lt;/P&gt;
&lt;P&gt;Like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let start=1706;
%let end=1809;

data _null_;
date = input("20&amp;amp;start.01",yymmdd8.);
length result $100;
do while (date &amp;lt; input("20&amp;amp;end.01",yymmdd8.));
  date = intnx('quarter',date,1,'s');
  result = catx('+',result,substr(put(date,yymmddn8.),3,4));
end;
call symputx('want',result);
run;

%put &amp;amp;want.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Dec 2018 09:49:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-sas-parameter-with-next-5-months-of-end-of-quarter/m-p/520306#M141059</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-12-11T09:49:36Z</dc:date>
    </item>
    <item>
      <title>Re: Create a sas parameter with next 5 months of end of quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-sas-parameter-with-next-5-months-of-end-of-quarter/m-p/520308#M141060</link>
      <description>&lt;P&gt;So rather than just programmatically implementing a solution whereby the user puts in one single parameter - ie the 1706 - and the code does the rest, your going to write code which takes that parameter, and then creates more parameters, to pass in to further code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Well rather you than me, stack of cards and all that,&amp;nbsp; Me, I would have one parameter, and then in the code, use a range to get this information - i.e. intnx() that one paramter to find anything within a 5 month window. I mean you already have written the base SAS code, just implement that in the receiving code.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Dec 2018 09:54:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-sas-parameter-with-next-5-months-of-end-of-quarter/m-p/520308#M141060</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-12-11T09:54:31Z</dc:date>
    </item>
    <item>
      <title>Re: Create a sas parameter with next 5 months of end of quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-sas-parameter-with-next-5-months-of-end-of-quarter/m-p/520309#M141061</link>
      <description>&lt;P&gt;Ok. Do like this then.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let last=1706;

data _null_;
   last=input("&amp;amp;last.",yymmn4.);
   array dates{5} $ date1-date5;
   do i=1 to dim(dates);
      dates[i]=trim(put(intnx('month',last,i*3), yymmn4.));
   end;
   call symputx('fivedates', catx('+', of date1-date5));
run;

%put &amp;amp;fivedates.;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Dec 2018 09:56:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-sas-parameter-with-next-5-months-of-end-of-quarter/m-p/520309#M141061</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-12-11T09:56:51Z</dc:date>
    </item>
    <item>
      <title>Re: vector- Create a sas parameter with next 5 months of end of quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-sas-parameter-with-next-5-months-of-end-of-quarter/m-p/520310#M141062</link>
      <description>&lt;P&gt;I also found solution&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data a;
 last_help=input("&amp;amp;last.",yymmn4.);           
format last_help yymmn4.;
/*SAS date of &amp;amp;last. with format YYMM*/
date1 = intnx('month',last_help,3); 
format date1 yymmn4.;  
date_char1=put(date1,yymmn4.);


date2 = intnx('month',last_help,6); 
format date2 yymmn4.;  
date_char2=put(date2,yymmn4.);


date3 = intnx('month',last_help,9); 
format date3 yymmn4.; 
date_char3=put(date3,yymmn4.);

date4 = intnx('month',last_help,12); 
format date4 yymmn4.; 
date_char4=put(date4,yymmn4.);

date5 = intnx('month',last_help,15); 
format date5 yymmn4.;
date_char5=put(date5,yymmn4.);

call symput("date_char1",trim(left(date_char1)));
call symput("date_char2",trim(left(date_char2)));
call symput("date_char3",trim(left(date_char3)));
call symput("date_char4",trim(left(date_char4)));
call symput("date_char5",trim(left(date_char5)));

vector=CATX("+",&amp;amp;date_char1.,&amp;amp;date_char2.,&amp;amp;date_char3.,&amp;amp;date_char4.,&amp;amp;date_char5.); 
call symput("vectorx",trim(left(vector)));

Run;
%put &amp;amp;vectorx.;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Dec 2018 10:03:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-sas-parameter-with-next-5-months-of-end-of-quarter/m-p/520310#M141062</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2018-12-11T10:03:23Z</dc:date>
    </item>
    <item>
      <title>Re: vector- Create a sas parameter with next 5 months of end of quarter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Create-a-sas-parameter-with-next-5-months-of-end-of-quarter/m-p/520311#M141063</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I also found solution&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data a;
 last_help=input("&amp;amp;last.",yymmn4.);           
format last_help yymmn4.;
/*SAS date of &amp;amp;last. with format YYMM*/
date1 = intnx('month',last_help,3); 
format date1 yymmn4.;  
date_char1=put(date1,yymmn4.);


date2 = intnx('month',last_help,6); 
format date2 yymmn4.;  
date_char2=put(date2,yymmn4.);


date3 = intnx('month',last_help,9); 
format date3 yymmn4.; 
date_char3=put(date3,yymmn4.);

date4 = intnx('month',last_help,12); 
format date4 yymmn4.; 
date_char4=put(date4,yymmn4.);

date5 = intnx('month',last_help,15); 
format date5 yymmn4.;
date_char5=put(date5,yymmn4.);

call symput("date_char1",trim(left(date_char1)));
call symput("date_char2",trim(left(date_char2)));
call symput("date_char3",trim(left(date_char3)));
call symput("date_char4",trim(left(date_char4)));
call symput("date_char5",trim(left(date_char5)));

vector=CATX("+",&amp;amp;date_char1.,&amp;amp;date_char2.,&amp;amp;date_char3.,&amp;amp;date_char4.,&amp;amp;date_char5.); 
call symput("vectorx",trim(left(vector)));

Run;
%put &amp;amp;vectorx.;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I'd be hard pressed to imagine a more unwieldy "solution". See that &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;'s solution and mine can be simply expanded by changing ONE parameter. Yours would need additional complicated code for every additional period, time and again.&lt;/P&gt;
&lt;P&gt;Always strive for simplicity.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Dec 2018 10:12:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Create-a-sas-parameter-with-next-5-months-of-end-of-quarter/m-p/520311#M141063</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-12-11T10:12:29Z</dc:date>
    </item>
  </channel>
</rss>

