<?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 tarr paremeter automatic from vector parameter in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/create-tarr-paremeter-automatic-from-vector-parameter/m-p/443698#M111027</link>
    <description>&lt;P&gt;You can do it with a function macro, like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro tarr(vector);
  %local date i r plus;
  %do i=1 %to %sysfunc(countw(&amp;amp;vector,+));
    %let date=%sysfunc(inputn(%scan(&amp;amp;vector,&amp;amp;i,+)01,yymmdd6.));
    %let r=&amp;amp;r.&amp;amp;plus.%str(%')%sysfunc(intnx(month,&amp;amp;date,0,e),date9.)%str(%')d;
    %let plus=+;
    %end;
%unquote(&amp;amp;r)
%mend;

%let tarr=%tarr(&amp;amp;vector);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 08 Mar 2018 10:07:25 GMT</pubDate>
    <dc:creator>s_lassen</dc:creator>
    <dc:date>2018-03-08T10:07:25Z</dc:date>
    <item>
      <title>create tarr paremeter automatic from vector parameter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-tarr-paremeter-automatic-from-vector-parameter/m-p/443664#M111019</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I define a SAS &amp;nbsp;parameter (called vector) that contain for example 2 arguments of dates (YYMM).&lt;/P&gt;&lt;P&gt;I also define another SAS &amp;nbsp;parameter (called &lt;SPAN&gt;tarr)&amp;nbsp;&lt;/SPAN&gt;that contain 2 arguments of dates .&lt;/P&gt;&lt;P&gt;tarr parameter contains dates that are 12 months before dates of vector paraemeter (and end of month).&lt;/P&gt;&lt;P&gt;My question is hot to create tarr paremeter automatic from vector parameter??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA Tbl1712;&lt;BR /&gt;INPUT ID ddate ddmmyy10. Y;&lt;BR /&gt;FORMAT ddate ddmmyy10. ;&lt;BR /&gt;CARDS;&lt;BR /&gt;1 01/01/2018 10&lt;BR /&gt;2 01/01/2017 20&lt;BR /&gt;3 01/01/2016 30&lt;BR /&gt;4 01/01/2015 40&lt;BR /&gt;;&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;DATA Tbl1612;&lt;BR /&gt;INPUT ID ddate ddmmyy10. Y;&lt;BR /&gt;FORMAT ddate ddmmyy10. ;&lt;BR /&gt;CARDS;&lt;BR /&gt;1 01/06/2018 10&lt;BR /&gt;2 01/06/2017 20&lt;BR /&gt;3 01/06/2016 30&lt;BR /&gt;4 01/06/2015 40&lt;BR /&gt;;&lt;BR /&gt;Run;&lt;/P&gt;&lt;P&gt;%let vector=1712+1612;&lt;BR /&gt;%let tarr='31Dec2016'd+'31Dec2015'd;/*My question is how to create it automatically)&lt;BR /&gt;%macro Macro1;&lt;BR /&gt;%do i=1 %to 2;&lt;BR /&gt;%let mon=%scan(&amp;amp;vector.,&amp;amp;i.,+);&lt;BR /&gt;%let tar=%scan(&amp;amp;tarr.,&amp;amp;i.,+);&lt;BR /&gt;data Output&amp;amp;mon.;&lt;BR /&gt;set Tbl&amp;amp;mon.;&lt;BR /&gt;if ddate&amp;lt;=&amp;amp;tar. then Y=0;&lt;BR /&gt;run;&lt;BR /&gt;%end;&lt;BR /&gt;%mend;&lt;BR /&gt;%Macro1;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Mar 2018 07:38:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-tarr-paremeter-automatic-from-vector-parameter/m-p/443664#M111019</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2018-03-08T07:38:40Z</dc:date>
    </item>
    <item>
      <title>Re: create tarr paremeter automatic from vector parameter</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-tarr-paremeter-automatic-from-vector-parameter/m-p/443698#M111027</link>
      <description>&lt;P&gt;You can do it with a function macro, like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro tarr(vector);
  %local date i r plus;
  %do i=1 %to %sysfunc(countw(&amp;amp;vector,+));
    %let date=%sysfunc(inputn(%scan(&amp;amp;vector,&amp;amp;i,+)01,yymmdd6.));
    %let r=&amp;amp;r.&amp;amp;plus.%str(%')%sysfunc(intnx(month,&amp;amp;date,0,e),date9.)%str(%')d;
    %let plus=+;
    %end;
%unquote(&amp;amp;r)
%mend;

%let tarr=%tarr(&amp;amp;vector);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Mar 2018 10:07:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-tarr-paremeter-automatic-from-vector-parameter/m-p/443698#M111027</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2018-03-08T10:07:25Z</dc:date>
    </item>
  </channel>
</rss>

