<?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: SAS arrays in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-arrays/m-p/334131#M75431</link>
    <description>&lt;P&gt;The statement&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;offset=i;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Is just an assignment statement. So it sets the value of OFFSET to the current value of I.&lt;/P&gt;
&lt;P&gt;The purspose seems to store the index into the array of the first non-missing element in the array. &amp;nbsp;So the offset from the begginnig of the list.&lt;/P&gt;
&lt;P&gt;So if you array had the series of values :&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;. . . . 15 23 7 .&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then OFFSET would get set to 5 since the first non-missing value is the 15 in the fifth position.&lt;/P&gt;
&lt;P&gt;The statement&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;I=26;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Is intended to cause the DO loop to end.&lt;/P&gt;
&lt;P&gt;You could re-write it like this and it might be a little clearer.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;offset=.;
do i=1 to dim(delq) while (offset=.);
  if not missing(delq(i)) then offset=i;
end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Also make sure the name you use in the ARRAY statement matches the name you are using in your array references. This loop is referencing the array named DELQ, but you did not include an ARRAY statement to define that array in the code you posted.&lt;/P&gt;</description>
    <pubDate>Sat, 18 Feb 2017 21:54:24 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2017-02-18T21:54:24Z</dc:date>
    <item>
      <title>SAS arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-arrays/m-p/334054#M75381</link>
      <description>&lt;PRE&gt;array salv(*) Performance_:;                                                                                                            
array delqnorm(26);                                                                                                                     
array maxdelqnorm(26);                                                                                                                  
format maxdelqfirst12m maxdelqever 1.;                                                                                                  
do i = 1 to 26;                                                                                                                         
  if not missing (delq(i)) then                                                                                                         
    do;                                                                                                                                 
      offset=i;                                                                                                                         
          i=26;                                                                                                                         
    end;                                                                                                                                
end; &lt;/PRE&gt;&lt;P&gt;Hi im new to sas programming... I'd came out through this code on SAS arrays... can anybody explain me what does "Performance_:" in line 1st and "offset=i" is representing here?&lt;/P&gt;</description>
      <pubDate>Sat, 18 Feb 2017 12:48:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-arrays/m-p/334054#M75381</guid>
      <dc:creator>Acp</dc:creator>
      <dc:date>2017-02-18T12:48:32Z</dc:date>
    </item>
    <item>
      <title>Re: SAS arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-arrays/m-p/334055#M75382</link>
      <description>&lt;P&gt;There are many ways to generate lists of variables names for use in array, keep, drop and other statements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The use of the right hand colon says to use all vars whose name begins with "performance_".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could also use&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; array x{*}&amp;nbsp;&amp;nbsp; performance_1-performance_5;&amp;nbsp;&amp;nbsp; /* single dash,which tells sas to look generate all vars performanc_1 performance_2 performance_3 performance_4 performance_5.*/&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or a specific list:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; array x{*} performance_1&amp;nbsp;performance_2&amp;nbsp;performance_2&amp;nbsp;performance_4&amp;nbsp;performance_5;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or a double dash&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; array x{*}&amp;nbsp;&amp;nbsp;&amp;nbsp; perform -- return ;&amp;nbsp;&amp;nbsp; /* which says to&amp;nbsp; use all vars from perform through return&amp;nbsp; in the program data vector.*/&lt;/P&gt;</description>
      <pubDate>Sat, 18 Feb 2017 13:16:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-arrays/m-p/334055#M75382</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-02-18T13:16:48Z</dc:date>
    </item>
    <item>
      <title>Re: SAS arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-arrays/m-p/334056#M75383</link>
      <description>&lt;P&gt;Thanks man for providing &amp;nbsp;such an easy solution.... and can you please tell what would be the use of "offset" in above program?&lt;/P&gt;</description>
      <pubDate>Sat, 18 Feb 2017 13:19:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-arrays/m-p/334056#M75383</guid>
      <dc:creator>Acp</dc:creator>
      <dc:date>2017-02-18T13:19:08Z</dc:date>
    </item>
    <item>
      <title>Re: SAS arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-arrays/m-p/334057#M75384</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The expression DELQ{i} says to use the i'th element of the array named DELQ, where i ranges from 1 to 26 in the DO loop (so your array better have at least 26 elements).&amp;nbsp; These 26 values are examined,&amp;nbsp;and OFFSET&amp;nbsp; will&amp;nbsp; end up as the index of the "most recent"&amp;nbsp; (i.e. the rightmost) element of the DELQ array that is&amp;nbsp;non-missing.&lt;/P&gt;</description>
      <pubDate>Sat, 18 Feb 2017 13:25:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-arrays/m-p/334057#M75384</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2017-02-18T13:25:37Z</dc:date>
    </item>
    <item>
      <title>Re: SAS arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-arrays/m-p/334081#M75395</link>
      <description>&lt;P&gt;Just to add to&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt;&amp;nbsp;post, you have a sysntax error in your code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;in order to use&amp;nbsp;&lt;STRONG&gt;delq(i) &amp;nbsp;&lt;/STRONG&gt;you have to define array by:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;array delq {26}&amp;nbsp;&lt;/STRONG&gt;delq_1 - delq_26; &amp;nbsp; /* or delq: &amp;nbsp;or xxx1-xxx26. &amp;nbsp;See&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31461"&gt;@mkeintz&lt;/a&gt;&amp;nbsp;post */&lt;/P&gt;
&lt;P&gt;- &lt;STRONG&gt;delq&lt;/STRONG&gt; is the array &lt;U&gt;name&lt;/U&gt;, while&lt;/P&gt;
&lt;P&gt;- &lt;STRONG&gt;delq1-delq26&lt;/STRONG&gt; are the variables making&amp;nbsp;the array&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Beyond, what did you mean by line:&lt;/P&gt;
&lt;PRE&gt;array maxdelqnorm(26);&lt;/PRE&gt;
&lt;P&gt;are there 26 max values ? what variables create the array called &amp;nbsp;&lt;STRONG&gt;maxdelqnorm&lt;/STRONG&gt;?&lt;/P&gt;</description>
      <pubDate>Sat, 18 Feb 2017 15:40:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-arrays/m-p/334081#M75395</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-02-18T15:40:33Z</dc:date>
    </item>
    <item>
      <title>Re: SAS arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-arrays/m-p/334131#M75431</link>
      <description>&lt;P&gt;The statement&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;offset=i;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Is just an assignment statement. So it sets the value of OFFSET to the current value of I.&lt;/P&gt;
&lt;P&gt;The purspose seems to store the index into the array of the first non-missing element in the array. &amp;nbsp;So the offset from the begginnig of the list.&lt;/P&gt;
&lt;P&gt;So if you array had the series of values :&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;. . . . 15 23 7 .&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then OFFSET would get set to 5 since the first non-missing value is the 15 in the fifth position.&lt;/P&gt;
&lt;P&gt;The statement&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;I=26;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Is intended to cause the DO loop to end.&lt;/P&gt;
&lt;P&gt;You could re-write it like this and it might be a little clearer.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;offset=.;
do i=1 to dim(delq) while (offset=.);
  if not missing(delq(i)) then offset=i;
end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Also make sure the name you use in the ARRAY statement matches the name you are using in your array references. This loop is referencing the array named DELQ, but you did not include an ARRAY statement to define that array in the code you posted.&lt;/P&gt;</description>
      <pubDate>Sat, 18 Feb 2017 21:54:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-arrays/m-p/334131#M75431</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-02-18T21:54:24Z</dc:date>
    </item>
  </channel>
</rss>

