<?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: Arrays and Do Loops with first and last in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Arrays-and-Do-Loops-with-first-and-last/m-p/553602#M16974</link>
    <description>&lt;P&gt;thank you very much;&lt;/P&gt;&lt;P&gt;it works&amp;nbsp;&lt;img id="manhappy" class="emoticon emoticon-manhappy" src="https://communities.sas.com/i/smilies/16x16_man-happy.png" alt="Man Happy" title="Man Happy" /&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 24 Apr 2019 12:39:45 GMT</pubDate>
    <dc:creator>farzad14000</dc:creator>
    <dc:date>2019-04-24T12:39:45Z</dc:date>
    <item>
      <title>Arrays and Do Loops with first and last</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Arrays-and-Do-Loops-with-first-and-last/m-p/553460#M16963</link>
      <description>&lt;P&gt;hello to everyone;&lt;/P&gt;&lt;P&gt;somebody knox why this code dos not work please,&lt;/P&gt;&lt;P&gt;data test33;&lt;BR /&gt;set perso.test;&lt;/P&gt;&lt;P&gt;by epci;&lt;BR /&gt;array sex (i) SEXE1_AGED100000-SEXE1_AGED100100;&lt;BR /&gt;do i=1to 101;&lt;BR /&gt;end;&lt;BR /&gt;array sexage(i) _NUMERIC_;&lt;BR /&gt;do i=1to 101;&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;if first.epci then sexage(i)=0;&lt;BR /&gt;sexage(i)+sex(i);&lt;BR /&gt;i=1to101;&lt;/P&gt;&lt;P&gt;if last.epci ;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;run;&lt;BR /&gt;proc print data=test33;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 22:56:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Arrays-and-Do-Loops-with-first-and-last/m-p/553460#M16963</guid>
      <dc:creator>farzad14000</dc:creator>
      <dc:date>2019-04-23T22:56:52Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays and Do Loops with first and last</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Arrays-and-Do-Loops-with-first-and-last/m-p/553468#M16965</link>
      <description>&lt;P&gt;because the design has not been thought out.&lt;/P&gt;
&lt;P&gt;you have do loops that do nothing.&lt;/P&gt;
&lt;P&gt;you have assignment outside of where you would obtain a value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Apr 2019 23:44:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Arrays-and-Do-Loops-with-first-and-last/m-p/553468#M16965</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2019-04-23T23:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays and Do Loops with first and last</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Arrays-and-Do-Loops-with-first-and-last/m-p/553507#M16969</link>
      <description>&lt;P&gt;This program has very few pieces that would work.&amp;nbsp; The best thing you did is accurately count the number of elements in your array.&amp;nbsp; I'm going to sketch out valid code for what I think you are trying to do here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test33;
set perso.test;

by epci;
array sexage {101} sexage000 - sexage100;
array sex {101} SEXE1_AGED100000-SEXE1_AGED100100;
if first.epci then do i=1 to 101;
   sexage{i} = 0;
end;
do i=1 to 101;
   sexage{i} + sex{i};
end;
if last.epci ;
run;
proc print data=test33;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But I'm guessing.&amp;nbsp; It would be easier if you would describe which variables you already have, which variables you would like to create, and what the logic is for creating them.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2019 03:05:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Arrays-and-Do-Loops-with-first-and-last/m-p/553507#M16969</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-04-24T03:05:48Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays and Do Loops with first and last</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Arrays-and-Do-Loops-with-first-and-last/m-p/553508#M16970</link>
      <description>&lt;P&gt;It looks like you are trying to do something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test33;
set perso.test;
by epci;
array sex SEXE1_AGED100000-SEXE1_AGED100100;
array sexage {101};
retain sexage:;
if first.epci then 
    do i=1 to 101;
        sexage{i}=0;
        end;
do i=1 to 101;
    sexage{i}=sexage{i}+sex{i};
    end;
if last.epci then output;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But that's just a wild guess.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;try to get the simple parts working first - arrays - -do loops -&amp;nbsp; - BY processing -&amp;nbsp; before combining them.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2019 03:06:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Arrays-and-Do-Loops-with-first-and-last/m-p/553508#M16970</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-04-24T03:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays and Do Loops with first and last</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Arrays-and-Do-Loops-with-first-and-last/m-p/553602#M16974</link>
      <description>&lt;P&gt;thank you very much;&lt;/P&gt;&lt;P&gt;it works&amp;nbsp;&lt;img id="manhappy" class="emoticon emoticon-manhappy" src="https://communities.sas.com/i/smilies/16x16_man-happy.png" alt="Man Happy" title="Man Happy" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2019 12:39:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Arrays-and-Do-Loops-with-first-and-last/m-p/553602#M16974</guid>
      <dc:creator>farzad14000</dc:creator>
      <dc:date>2019-04-24T12:39:45Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays and Do Loops with first and last</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Arrays-and-Do-Loops-with-first-and-last/m-p/553629#M16975</link>
      <description>&lt;P&gt;thanks a lot&lt;/P&gt;</description>
      <pubDate>Wed, 24 Apr 2019 13:16:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Arrays-and-Do-Loops-with-first-and-last/m-p/553629#M16975</guid>
      <dc:creator>farzad14000</dc:creator>
      <dc:date>2019-04-24T13:16:11Z</dc:date>
    </item>
  </channel>
</rss>

