<?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 and arrays in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Do-loop-and-arrays/m-p/564116#M158204</link>
    <description>&lt;P&gt;I don't see anything wrong with your code.&amp;nbsp; (Although you should add a RUN statement to end your data step.)&lt;/P&gt;
&lt;P&gt;What problems are you actually having? If you are getting errors show the log (make sure to use the INSERT CODE icon on the editor menu to pop-up a window where you can paste the text from the log).&lt;/P&gt;</description>
    <pubDate>Thu, 06 Jun 2019 14:23:14 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2019-06-06T14:23:14Z</dc:date>
    <item>
      <title>Do loop and arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-loop-and-arrays/m-p/564098#M158200</link>
      <description>&lt;P&gt;&amp;nbsp;Hello guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a data for 11 stress variables. Each item had 4 possible responses (1-4) with “4” indicating the worse stress. I am trying to write a code to print out all subjects who selected "4" for atleast 6 of the 11 items. The part in bold is where i've struggled to do.&lt;/P&gt;&lt;P&gt;Any correction will be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data one; set mike;&lt;BR /&gt;array stress stress1-stress11;&lt;BR /&gt;count=0;&lt;BR /&gt;do over stress;&lt;BR /&gt;if stress = 4 then count= count+1;&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;proc print; var stress1-stress11 count;&lt;BR /&gt;where count &amp;gt;=6;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2019 14:06:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-loop-and-arrays/m-p/564098#M158200</guid>
      <dc:creator>ChuksManuel</dc:creator>
      <dc:date>2019-06-06T14:06:24Z</dc:date>
    </item>
    <item>
      <title>Re: Do loop and arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-loop-and-arrays/m-p/564103#M158202</link>
      <description>&lt;P&gt;Here is one way&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have(drop=i j);
   array stress{11};
   do i=1 to 100;
      do j=1 to dim(stress);
         stress[j]=rand('integer', 1, 4);
      end;
   output;
   end;
run;

data want(drop=i);
   set have;
   array stress{11};
   count=0;
   do i=1 to dim(stress);
      if stress[i]=4 then count=count+1;
   end;
run;

proc print data=want;
   where count ge 6;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Jun 2019 14:12:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-loop-and-arrays/m-p/564103#M158202</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-06-06T14:12:50Z</dc:date>
    </item>
    <item>
      <title>Re: Do loop and arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-loop-and-arrays/m-p/564116#M158204</link>
      <description>&lt;P&gt;I don't see anything wrong with your code.&amp;nbsp; (Although you should add a RUN statement to end your data step.)&lt;/P&gt;
&lt;P&gt;What problems are you actually having? If you are getting errors show the log (make sure to use the INSERT CODE icon on the editor menu to pop-up a window where you can paste the text from the log).&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2019 14:23:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-loop-and-arrays/m-p/564116#M158204</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-06-06T14:23:14Z</dc:date>
    </item>
    <item>
      <title>Re: Do loop and arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-loop-and-arrays/m-p/564163#M158217</link>
      <description>&lt;P&gt;Thank you. That gave me another perspective on how to do the task.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2019 15:22:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-loop-and-arrays/m-p/564163#M158217</guid>
      <dc:creator>ChuksManuel</dc:creator>
      <dc:date>2019-06-06T15:22:05Z</dc:date>
    </item>
    <item>
      <title>Re: Do loop and arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-loop-and-arrays/m-p/564164#M158218</link>
      <description>&lt;P&gt;Thank you!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jun 2019 15:23:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-loop-and-arrays/m-p/564164#M158218</guid>
      <dc:creator>ChuksManuel</dc:creator>
      <dc:date>2019-06-06T15:23:06Z</dc:date>
    </item>
  </channel>
</rss>

