<?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 Error illegal use of array in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Error-illegal-use-of-array/m-p/556319#M9804</link>
    <description>&lt;P&gt;My code is returning an error an am not sure why&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original code&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DATA scoredata1;&lt;BR /&gt;set scoredata0;&lt;BR /&gt;&lt;BR /&gt;Array sc(3) score1 score2 score3;&lt;BR /&gt;Array new (3) ns1 ns2 ns3;&lt;BR /&gt;DO i=1 TO 3;&lt;BR /&gt;IF sc(i)=777 then new(i)= .;&lt;BR /&gt;else if sc NE 777 then new(i) = sc(i) ;   &lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="adn ads"&gt;&lt;DIV class="gs"&gt;&lt;DIV class=""&gt;&lt;DIV class="ii gt"&gt;&lt;DIV class="a3s aXjCH "&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasSource"&gt;1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasSource"&gt;72&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasSource"&gt;73 DATA scoredata1;&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasSource"&gt;74 set scoredata0;&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasSource"&gt;75&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasSource"&gt;76 Array sc(3) score1 score2 score3;&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasSource"&gt;77 Array new(3) ns1 ns2 ns3;&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasSource"&gt;78 DO i= 1 TO 3;&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasSource"&gt;79 IF sc(i) = 777 then new(i)= .;&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasSource"&gt;80 else if sc NE 777 then new(i) = sc(i);&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasError"&gt;ERROR: Illegal reference to the array sc.&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasSource"&gt;81 end;&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasSource"&gt;82 run;&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasNote"&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasWarning"&gt;WARNING: The data set WORK.SCOREDATA1 may be incomplete. When this step was stopped there were 0 observations and 9 variables.&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasNote"&gt;NOTE: DATA statement used (Total process time):&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasNote"&gt;real time 0.03 seconds&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasNote"&gt;cpu time 0.02 seconds&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="yj6qo"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="adL"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="hi"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="ajx"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="gA gt acV"&gt;&lt;DIV class="gB xu"&gt;&lt;DIV class="ip iq"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Mon, 06 May 2019 01:06:50 GMT</pubDate>
    <dc:creator>rylife</dc:creator>
    <dc:date>2019-05-06T01:06:50Z</dc:date>
    <item>
      <title>Error illegal use of array</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Error-illegal-use-of-array/m-p/556319#M9804</link>
      <description>&lt;P&gt;My code is returning an error an am not sure why&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original code&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;DATA scoredata1;&lt;BR /&gt;set scoredata0;&lt;BR /&gt;&lt;BR /&gt;Array sc(3) score1 score2 score3;&lt;BR /&gt;Array new (3) ns1 ns2 ns3;&lt;BR /&gt;DO i=1 TO 3;&lt;BR /&gt;IF sc(i)=777 then new(i)= .;&lt;BR /&gt;else if sc NE 777 then new(i) = sc(i) ;   &lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="adn ads"&gt;&lt;DIV class="gs"&gt;&lt;DIV class=""&gt;&lt;DIV class="ii gt"&gt;&lt;DIV class="a3s aXjCH "&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasSource"&gt;1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasSource"&gt;72&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasSource"&gt;73 DATA scoredata1;&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasSource"&gt;74 set scoredata0;&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasSource"&gt;75&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasSource"&gt;76 Array sc(3) score1 score2 score3;&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasSource"&gt;77 Array new(3) ns1 ns2 ns3;&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasSource"&gt;78 DO i= 1 TO 3;&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasSource"&gt;79 IF sc(i) = 777 then new(i)= .;&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasSource"&gt;80 else if sc NE 777 then new(i) = sc(i);&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasError"&gt;ERROR: Illegal reference to the array sc.&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasSource"&gt;81 end;&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasSource"&gt;82 run;&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasNote"&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasWarning"&gt;WARNING: The data set WORK.SCOREDATA1 may be incomplete. When this step was stopped there were 0 observations and 9 variables.&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasNote"&gt;NOTE: DATA statement used (Total process time):&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasNote"&gt;real time 0.03 seconds&lt;/DIV&gt;&lt;DIV class="m_-5062853613097738524gmail-sasNote"&gt;cpu time 0.02 seconds&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="yj6qo"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="adL"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="hi"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="ajx"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="gA gt acV"&gt;&lt;DIV class="gB xu"&gt;&lt;DIV class="ip iq"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 06 May 2019 01:06:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Error-illegal-use-of-array/m-p/556319#M9804</guid>
      <dc:creator>rylife</dc:creator>
      <dc:date>2019-05-06T01:06:50Z</dc:date>
    </item>
    <item>
      <title>Re: Error illegal use of array</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Error-illegal-use-of-array/m-p/556320#M9805</link>
      <description>&lt;PRE&gt;else  new(i) = sc(i) ; &lt;/PRE&gt;
&lt;P&gt;is all you need i think&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The error is you are mising the array index while referencing in your&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;else if sc NE 777 then new(i) = sc(i) ; &lt;/PRE&gt;
&lt;P&gt;which should have been&lt;/P&gt;
&lt;PRE&gt;else if sc(i) NE 777 then new(i) = sc(i) ; &lt;/PRE&gt;</description>
      <pubDate>Mon, 06 May 2019 01:12:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Error-illegal-use-of-array/m-p/556320#M9805</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-05-06T01:12:11Z</dc:date>
    </item>
    <item>
      <title>Re: Error illegal use of array</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Error-illegal-use-of-array/m-p/556321#M9806</link>
      <description>&lt;P&gt;Or even terse would be just one statement and that is&lt;/P&gt;
&lt;PRE&gt;if sc(i) NE 777 then new(i) = sc(i) ; &lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Coz new(i) is anyway initialised with &lt;STRONG&gt;.&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2019 01:37:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Error-illegal-use-of-array/m-p/556321#M9806</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-05-06T01:37:43Z</dc:date>
    </item>
    <item>
      <title>Re: Error illegal use of array</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Error-illegal-use-of-array/m-p/556324#M9807</link>
      <description>&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 06 May 2019 02:11:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Error-illegal-use-of-array/m-p/556324#M9807</guid>
      <dc:creator>rylife</dc:creator>
      <dc:date>2019-05-06T02:11:41Z</dc:date>
    </item>
  </channel>
</rss>

