<?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 Looping to get 41  files having the year *1000 until year*1000+900 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Looping-to-get-41-files-having-the-year-1000-until-year-1000-900/m-p/698040#M213429</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I need 41 files from Y1980 to Y2020 with one variable (index) going from year*1000 to year*1000+900.&lt;/P&gt;&lt;P&gt;So for Y1980, Index will range from 19800000 to 19800900.&lt;/P&gt;&lt;P&gt;I wrote the following but the result is not as expected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro myloop;&lt;BR /&gt;%do i=1980 %to 2020;&lt;BR /&gt;data Y&amp;amp;i;&lt;BR /&gt;%do index=&amp;amp;i*1000 %to &amp;amp;i*1000+900;&lt;BR /&gt;output;&lt;BR /&gt;%end;&lt;BR /&gt;run;&lt;BR /&gt;%end;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%myloop;&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, 10 Nov 2020 23:29:14 GMT</pubDate>
    <dc:creator>Noomen</dc:creator>
    <dc:date>2020-11-10T23:29:14Z</dc:date>
    <item>
      <title>Looping to get 41  files having the year *1000 until year*1000+900</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looping-to-get-41-files-having-the-year-1000-until-year-1000-900/m-p/698040#M213429</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I need 41 files from Y1980 to Y2020 with one variable (index) going from year*1000 to year*1000+900.&lt;/P&gt;&lt;P&gt;So for Y1980, Index will range from 19800000 to 19800900.&lt;/P&gt;&lt;P&gt;I wrote the following but the result is not as expected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro myloop;&lt;BR /&gt;%do i=1980 %to 2020;&lt;BR /&gt;data Y&amp;amp;i;&lt;BR /&gt;%do index=&amp;amp;i*1000 %to &amp;amp;i*1000+900;&lt;BR /&gt;output;&lt;BR /&gt;%end;&lt;BR /&gt;run;&lt;BR /&gt;%end;&lt;/P&gt;&lt;P&gt;%mend;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%myloop;&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, 10 Nov 2020 23:29:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looping-to-get-41-files-having-the-year-1000-until-year-1000-900/m-p/698040#M213429</guid>
      <dc:creator>Noomen</dc:creator>
      <dc:date>2020-11-10T23:29:14Z</dc:date>
    </item>
    <item>
      <title>Re: Looping to get 41  files having the year *1000 until year*1000+900</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looping-to-get-41-files-having-the-year-1000-until-year-1000-900/m-p/698041#M213430</link>
      <description>&lt;P&gt;Looks like you are confusing macro and SAS code loops. Is this more like it?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro myloop;
%do i=1980 %to 2020;
data Y&amp;amp;i;
do index=&amp;amp;i*1000 to &amp;amp;i*1000+900;
output;
end;
run;
%end;

%mend;

 

%myloop;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Nov 2020 23:36:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looping-to-get-41-files-having-the-year-1000-until-year-1000-900/m-p/698041#M213430</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-11-10T23:36:09Z</dc:date>
    </item>
    <item>
      <title>Re: Looping to get 41  files having the year *1000 until year*1000+900</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Looping-to-get-41-files-having-the-year-1000-until-year-1000-900/m-p/698088#M213457</link>
      <description>&lt;P&gt;The macro language is a&amp;nbsp;&lt;EM&gt;code generator&lt;/EM&gt;, and the code you created through it looks like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Y1980;
output;
output;
output;
/* repeat 901 times all in all */
output;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To create or manipulate&amp;nbsp;&lt;EM&gt;data&lt;/EM&gt;, you use the&amp;nbsp;&lt;EM&gt;data step&lt;/EM&gt; language, to create&amp;nbsp;&lt;EM&gt;code&lt;/EM&gt;, you use the macro language.&lt;/P&gt;
&lt;P&gt;Macro variables (&amp;amp;index in your case) are only "visible" to the macro processor, not to the created code (unless you use them as parts of the created code).&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2020 07:06:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Looping-to-get-41-files-having-the-year-1000-until-year-1000-900/m-p/698088#M213457</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-11-11T07:06:21Z</dc:date>
    </item>
  </channel>
</rss>

