<?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: Do loop to increase years in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Do-loop-to-increase-years/m-p/247118#M13028</link>
    <description>&lt;P&gt;I'm not sure how that changes anything. You can use the libname function inside a data null step to create the library based on the LT/UT variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Why are you creating macro variables outside your process, its better to keep it internal to your process.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;

lts=substr("&amp;amp;lt", 3, 2);
uts=substr("&amp;amp;ut", 3, 2);

rc=libname(cats(dir, lts, uts));

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sun, 31 Jan 2016 18:55:59 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-01-31T18:55:59Z</dc:date>
    <item>
      <title>Do loop to increase years</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Do-loop-to-increase-years/m-p/247068#M13022</link>
      <description>&lt;P&gt;Hi, folks -&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to develop&amp;nbsp;some statistical models using different training samples and then test their forecasting power on different holdout sample. For this purpose, I used window rolling approach in where both training and holdout sample move ahead untile specific year.&lt;/P&gt;&lt;P&gt;%let LT=2000;&lt;/P&gt;&lt;P&gt;%let UT=2005;&lt;/P&gt;&lt;P&gt;%let LH=2006;&lt;/P&gt;&lt;P&gt;%let UH=2008;&lt;/P&gt;&lt;P&gt;%macro_static_models(LT=&amp;amp;LT, UT=&amp;amp;UT, LH=&amp;amp;LH, UH=&amp;amp;UH);&lt;/P&gt;&lt;P&gt;so in the next round, I want to move one year ahead and have;&lt;/P&gt;&lt;P&gt;%let LT=2001;&lt;/P&gt;&lt;P&gt;%let UT=2006;&lt;/P&gt;&lt;P&gt;%let LH=2007;&lt;/P&gt;&lt;P&gt;%let UH=2009;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f5f6f5;"&gt;% macro_static_models (LT=&amp;amp;LT, UT=&amp;amp;UT, LH=&amp;amp;LH, UH=&amp;amp;UH) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #f5f6f5;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;the LT will stop at 2009. Do you have any suggestion how can I incorporate Do loop?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sat, 30 Jan 2016 23:00:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Do-loop-to-increase-years/m-p/247068#M13022</guid>
      <dc:creator>Moh</dc:creator>
      <dc:date>2016-01-30T23:00:11Z</dc:date>
    </item>
    <item>
      <title>Re: Do loop to increase years</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Do-loop-to-increase-years/m-p/247073#M13023</link>
      <description>&lt;P&gt;Use call execute.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;

lt=1999; ut=2004;

do i=1 to 10;
   lt=lt+1;
   ut=ut+1;

    str=cats('%macro_static_models(LT=', lt, ',UT=', UT, ');');

    call execute(str);

end;
run;



&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 30 Jan 2016 23:58:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Do-loop-to-increase-years/m-p/247073#M13023</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-01-30T23:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: Do loop to increase years</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Do-loop-to-increase-years/m-p/247092#M13024</link>
      <description>&lt;P&gt;Using &lt;STRONG&gt;call execute&lt;/STRONG&gt; to call a macro is safer if you prevent macro expansion at the call time with &lt;STRONG&gt;%nrstr&lt;/STRONG&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data _null_;
length line $200;
do lt = 2000 to 2009;
    line = cats('%nrstr(%macro_static_models(LT=', lt, ',UT=', lt+5, ',LH=', lt+6, ',UH=', lt+8, '));');
    call execute(line);
    end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 31 Jan 2016 04:37:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Do-loop-to-increase-years/m-p/247092#M13024</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-01-31T04:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: Do loop to increase years</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Do-loop-to-increase-years/m-p/247111#M13027</link>
      <description>&lt;P&gt;many thanks for your reply. Actually, I forgot to add something else. I need to define new libraries for each round of tests.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use the last two digits of each year as a&amp;nbsp;proxy for lib names, e.g.&amp;nbsp;S&amp;amp;LTS&amp;amp;UHS&amp;amp;Y.C.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let LT=2000;&lt;/P&gt;&lt;P&gt;%let UT=2005;&lt;/P&gt;&lt;P&gt;%let LH=2006;&lt;/P&gt;&lt;P&gt;%let UH=2008;&lt;/P&gt;&lt;P&gt;%let&amp;nbsp;LTS=00;&lt;/P&gt;&lt;P&gt;%let UTS=05;&lt;/P&gt;&lt;P&gt;%let LHS=06;&lt;/P&gt;&lt;P&gt;%let UHS=08;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro_static_models(LT=&amp;amp;LT, UT=&amp;amp;UT, LH=&amp;amp;LH, UH=&amp;amp;UH);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would you please kindly help me ? thanks&lt;/P&gt;</description>
      <pubDate>Sun, 31 Jan 2016 15:23:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Do-loop-to-increase-years/m-p/247111#M13027</guid>
      <dc:creator>Moh</dc:creator>
      <dc:date>2016-01-31T15:23:23Z</dc:date>
    </item>
    <item>
      <title>Re: Do loop to increase years</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Do-loop-to-increase-years/m-p/247118#M13028</link>
      <description>&lt;P&gt;I'm not sure how that changes anything. You can use the libname function inside a data null step to create the library based on the LT/UT variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Why are you creating macro variables outside your process, its better to keep it internal to your process.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;

lts=substr("&amp;amp;lt", 3, 2);
uts=substr("&amp;amp;ut", 3, 2);

rc=libname(cats(dir, lts, uts));

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 31 Jan 2016 18:55:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Do-loop-to-increase-years/m-p/247118#M13028</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-01-31T18:55:59Z</dc:date>
    </item>
  </channel>
</rss>

