<?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 Position of sequential variables in an array created using a colon in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Position-of-sequential-variables-in-an-array-created-using-a/m-p/490902#M128597</link>
    <description>&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;I have several variables ordered in SAS such as this: var_10_1, var_10_2,&amp;nbsp;var_1_1, var_1_2, var_2_1, var_2_2.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;If I use an array statement&amp;nbsp;such as the following, what position would these variables be in? &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="5"&gt;array&lt;/FONT&gt;&lt;FONT face="Courier New" size="5"&gt;&amp;nbsp;var (&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="5"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="5"&gt;:&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="5"&gt;10&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="5"&gt;) var_:;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;I'm thinking they are character sorted so var_10_1 is before var_1_1, but the order by which they are in the dataset (which is the same in this circumstance) could also be an option. If the latter is the case&amp;nbsp;I can use a retain to re-order them, but if the former is the case I'll have to come up with a different solution to put var_1 before var_10.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;Thanks for you help!&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 29 Aug 2018 16:09:02 GMT</pubDate>
    <dc:creator>whitknee48</dc:creator>
    <dc:date>2018-08-29T16:09:02Z</dc:date>
    <item>
      <title>Position of sequential variables in an array created using a colon</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Position-of-sequential-variables-in-an-array-created-using-a/m-p/490902#M128597</link>
      <description>&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;I have several variables ordered in SAS such as this: var_10_1, var_10_2,&amp;nbsp;var_1_1, var_1_2, var_2_1, var_2_2.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;If I use an array statement&amp;nbsp;such as the following, what position would these variables be in? &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="5"&gt;array&lt;/FONT&gt;&lt;FONT face="Courier New" size="5"&gt;&amp;nbsp;var (&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="5"&gt;1&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="5"&gt;:&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="5"&gt;10&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="5"&gt;) var_:;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif" size="3"&gt;I'm thinking they are character sorted so var_10_1 is before var_1_1, but the order by which they are in the dataset (which is the same in this circumstance) could also be an option. If the latter is the case&amp;nbsp;I can use a retain to re-order them, but if the former is the case I'll have to come up with a different solution to put var_1 before var_10.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="3"&gt;Thanks for you help!&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 16:09:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Position-of-sequential-variables-in-an-array-created-using-a/m-p/490902#M128597</guid>
      <dc:creator>whitknee48</dc:creator>
      <dc:date>2018-08-29T16:09:02Z</dc:date>
    </item>
    <item>
      <title>Re: Position of sequential variables in an array created using a colon</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Position-of-sequential-variables-in-an-array-created-using-a/m-p/490905#M128599</link>
      <description>&lt;P&gt;Use VNAME to test it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Given your indexes perhasps you want a two dimensional array making it easier to know which you’re referencing?&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 16:20:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Position-of-sequential-variables-in-an-array-created-using-a/m-p/490905#M128599</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-08-29T16:20:04Z</dc:date>
    </item>
    <item>
      <title>Re: Position of sequential variables in an array created using a colon</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Position-of-sequential-variables-in-an-array-created-using-a/m-p/490973#M128628</link>
      <description>&lt;P&gt;The order in the array is the order in which the variables were first created.&amp;nbsp; You can check that by running a PROC CONTENTS.&amp;nbsp; One of the pieces of output is the order of the variables.&amp;nbsp; You can even shorten the output to refer to just the variables of interest:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc contents data=have (keep=var_: );&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And as was mentioned, if you are processing the variables within a DATA step, using a DO loop and an array, the VNAME function will tell you the variable name for the current array element.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Aug 2018 19:52:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Position-of-sequential-variables-in-an-array-created-using-a/m-p/490973#M128628</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-08-29T19:52:35Z</dc:date>
    </item>
  </channel>
</rss>

