<?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: Urgent | What is wrong in my code? Using SAS 9.4 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Urgent-What-is-wrong-in-my-code-Using-SAS-9-4/m-p/311538#M67363</link>
    <description>&lt;P&gt;I'm heavily biased toward using a DATA step, but I would switch for this task:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;select count(*) from animal_weight where weight &amp;gt;= 200;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Nov 2016 21:57:21 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2016-11-14T21:57:21Z</dc:date>
    <item>
      <title>Urgent | What is wrong in my code? Using SAS 9.4</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Urgent-What-is-wrong-in-my-code-Using-SAS-9-4/m-p/311519#M67348</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Q.&amp;nbsp;Write the data step that creates a variable that&lt;/STRONG&gt;&lt;STRONG&gt;&amp;nbsp;should have the number of animals that are 200 kg or heavier than 200 kg.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;My Ans - This code is not giving me desired results. Any modification&amp;nbsp;on what is the issue ASAP will be of great help.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data animal_weight;&lt;BR /&gt;input animals $ weight;&lt;BR /&gt;datalines;&lt;BR /&gt;dog 19&lt;BR /&gt;cat 14&lt;BR /&gt;mice 0.25&lt;BR /&gt;camel 575&lt;BR /&gt;pigeon 0.57&lt;BR /&gt;cow 475&lt;BR /&gt;goat 18&lt;BR /&gt;fish 4&lt;BR /&gt;horse 450&lt;BR /&gt;donkey 330&lt;BR /&gt;monkey 23&lt;BR /&gt;lion 580&lt;BR /&gt;rat 0.69&lt;BR /&gt;rabbit 2.5&lt;BR /&gt;Pig 235&lt;BR /&gt;crow 1.8&lt;BR /&gt;;&lt;BR /&gt;run;&lt;BR /&gt;data sum; set animal_weight;&lt;BR /&gt;count=0;&lt;BR /&gt;array animl(*)_numeric_;&lt;BR /&gt;do i = 1 to 16;&lt;BR /&gt;if animl(i) &amp;gt;= 200 then count + animl(i);&lt;BR /&gt;proc print data=sum;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2016 20:49:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Urgent-What-is-wrong-in-my-code-Using-SAS-9-4/m-p/311519#M67348</guid>
      <dc:creator>JayP</dc:creator>
      <dc:date>2016-11-14T20:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: Urgent | What is wrong in my code? Using SAS 9.4</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Urgent-What-is-wrong-in-my-code-Using-SAS-9-4/m-p/311527#M67355</link>
      <description>&lt;P&gt;Revise the notion of implicit looping in the data step. This would work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data over200; 
set animal_weight end=done;
count + (weight &amp;gt;= 200);
if done then output;
keep count;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Explain the role of each statement to deserve a good mark.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2016 21:13:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Urgent-What-is-wrong-in-my-code-Using-SAS-9-4/m-p/311527#M67355</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-11-14T21:13:12Z</dc:date>
    </item>
    <item>
      <title>Re: Urgent | What is wrong in my code? Using SAS 9.4</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Urgent-What-is-wrong-in-my-code-Using-SAS-9-4/m-p/311529#M67357</link>
      <description>&lt;P&gt;Your first step creates a table where each animal holds one row;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You cannot use array to deal with different rows;&lt;/P&gt;
&lt;P&gt;You can use an array only to deal with a set of variables in the same row.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Next code will do what you ask:&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; set animal_weight &amp;nbsp;end=eof;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;STRONG&gt;retain count &amp;nbsp;sum_weight &amp;nbsp;0&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if weight GE 200 then do;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;STRONG&gt;sum_weight = sum(of &amp;nbsp;sum_weight , weight);&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;count+1;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if eof then put&amp;nbsp;sum_weight= &amp;nbsp;count=;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2016 21:19:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Urgent-What-is-wrong-in-my-code-Using-SAS-9-4/m-p/311529#M67357</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2016-11-14T21:19:27Z</dc:date>
    </item>
    <item>
      <title>Re: Urgent | What is wrong in my code? Using SAS 9.4</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Urgent-What-is-wrong-in-my-code-Using-SAS-9-4/m-p/311538#M67363</link>
      <description>&lt;P&gt;I'm heavily biased toward using a DATA step, but I would switch for this task:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;/P&gt;
&lt;P&gt;select count(*) from animal_weight where weight &amp;gt;= 200;&lt;/P&gt;
&lt;P&gt;quit;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Nov 2016 21:57:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Urgent-What-is-wrong-in-my-code-Using-SAS-9-4/m-p/311538#M67363</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-11-14T21:57:21Z</dc:date>
    </item>
  </channel>
</rss>

