<?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 question about array with variables that aren't listed next to each other in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/question-about-array-with-variables-that-aren-t-listed-next-to/m-p/591900#M169657</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an array but the data is set up such that the array variables are separated by a binary variable. Does this matter to form the below variable called paymentsum or will SAS not recognize the array without the 3 variables lined up?&amp;nbsp; When I do this, I don't always get the right answer so am wondering...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Laura&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;array pay [3] paymentsum1-paymentsum3;
   do p=1 to 3;
     paymentsum=pay[p];
      output; 
   end; drop p;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 26 Sep 2019 15:44:49 GMT</pubDate>
    <dc:creator>lmyers2</dc:creator>
    <dc:date>2019-09-26T15:44:49Z</dc:date>
    <item>
      <title>question about array with variables that aren't listed next to each other</title>
      <link>https://communities.sas.com/t5/SAS-Programming/question-about-array-with-variables-that-aren-t-listed-next-to/m-p/591900#M169657</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an array but the data is set up such that the array variables are separated by a binary variable. Does this matter to form the below variable called paymentsum or will SAS not recognize the array without the 3 variables lined up?&amp;nbsp; When I do this, I don't always get the right answer so am wondering...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Laura&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;array pay [3] paymentsum1-paymentsum3;
   do p=1 to 3;
     paymentsum=pay[p];
      output; 
   end; drop p;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 Sep 2019 15:44:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/question-about-array-with-variables-that-aren-t-listed-next-to/m-p/591900#M169657</guid>
      <dc:creator>lmyers2</dc:creator>
      <dc:date>2019-09-26T15:44:49Z</dc:date>
    </item>
    <item>
      <title>Re: question about array with variables that aren't listed next to each other</title>
      <link>https://communities.sas.com/t5/SAS-Programming/question-about-array-with-variables-that-aren-t-listed-next-to/m-p/591902#M169658</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/165633"&gt;@lmyers2&lt;/a&gt;&amp;nbsp; &amp;nbsp;In a prod environment, the best bet is to list down names ones. Yes, that means typing each name in the array one by one.&amp;nbsp; A one time effort. But in any case, it would help if you could post a representative sample of what you have for pointed answers. Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2019 15:47:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/question-about-array-with-variables-that-aren-t-listed-next-to/m-p/591902#M169658</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-09-26T15:47:16Z</dc:date>
    </item>
    <item>
      <title>Re: question about array with variables that aren't listed next to each other</title>
      <link>https://communities.sas.com/t5/SAS-Programming/question-about-array-with-variables-that-aren-t-listed-next-to/m-p/591908#M169660</link>
      <description>&lt;P&gt;Your code is fine and the position of the variables in the data vector will not impact it.&lt;/P&gt;
&lt;P&gt;When using a single hyphen to make a variable list the names must have the same base and numeric suffix.&amp;nbsp; So&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;paymentsum1-paymentsum3&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is a shortcut for this list:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;paymentsum1 paymentsum2 paymentsum3&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt;When you use a double hyphen then to list is composed of the variables based on their order.&amp;nbsp; So if your dataset had these 6 variables in this exact order:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;paymentsum1 flag1 paymentsum2 flag2 paymentsum3 flag3&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And you used a positional variable list like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;paymentsum1 -- paymentsum3&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;then that would mean these five variables:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;paymentsum1 flag1 paymentsum2 flag2 paymentsum3&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2019 16:03:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/question-about-array-with-variables-that-aren-t-listed-next-to/m-p/591908#M169660</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-09-26T16:03:40Z</dc:date>
    </item>
  </channel>
</rss>

