<?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 Changing non-sequential variable names to integers to reference them in array in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Changing-non-sequential-variable-names-to-integers-to-reference/m-p/649583#M194770</link>
    <description>&lt;P&gt;I have Table1 in the format&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Var1&amp;nbsp; &amp;nbsp;Var2&amp;nbsp; &amp;nbsp;Var3&amp;nbsp; &amp;nbsp;Var4&amp;nbsp; &amp;nbsp;Var5&amp;nbsp; &amp;nbsp;... ...&amp;nbsp; &amp;nbsp;Var103&lt;/P&gt;&lt;P&gt;A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; E&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;I&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; M&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Q&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; U&lt;/P&gt;&lt;P&gt;B&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; F&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;J&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;R&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; V&lt;/P&gt;&lt;P&gt;C&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;K&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;O&lt;/P&gt;&lt;P&gt;D&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; H&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; L&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; P&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;T&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; X&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where Variables Var3 through Var103 are alpha-numeric in alphabetical order, But their alphabetic prefixes are different. So i cannot reference them as Var3-Var103 to create an array.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also have Table2&lt;/P&gt;&lt;P&gt;Col1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Col2&lt;/P&gt;&lt;P&gt;Var3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;Var4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&lt;/P&gt;&lt;P&gt;Var5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;Var103&amp;nbsp; &amp;nbsp; &amp;nbsp;100&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to switch Var3 to Var103&amp;nbsp; in Table1 with the 1-100 from Table2, so as to be able to reference them as an array.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then once I finish manipulating the array as needed, switch back to Var3 to Var103?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or simpler, is there a way to fill the missing values in Table1 with '.' values, without referencing each variable?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 21 May 2020 14:35:15 GMT</pubDate>
    <dc:creator>mcook</dc:creator>
    <dc:date>2020-05-21T14:35:15Z</dc:date>
    <item>
      <title>Changing non-sequential variable names to integers to reference them in array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-non-sequential-variable-names-to-integers-to-reference/m-p/649583#M194770</link>
      <description>&lt;P&gt;I have Table1 in the format&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Var1&amp;nbsp; &amp;nbsp;Var2&amp;nbsp; &amp;nbsp;Var3&amp;nbsp; &amp;nbsp;Var4&amp;nbsp; &amp;nbsp;Var5&amp;nbsp; &amp;nbsp;... ...&amp;nbsp; &amp;nbsp;Var103&lt;/P&gt;&lt;P&gt;A&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; E&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;I&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; M&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Q&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; U&lt;/P&gt;&lt;P&gt;B&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; F&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;J&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;R&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; V&lt;/P&gt;&lt;P&gt;C&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;K&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;O&lt;/P&gt;&lt;P&gt;D&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; H&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; L&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; P&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;T&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; X&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where Variables Var3 through Var103 are alpha-numeric in alphabetical order, But their alphabetic prefixes are different. So i cannot reference them as Var3-Var103 to create an array.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also have Table2&lt;/P&gt;&lt;P&gt;Col1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Col2&lt;/P&gt;&lt;P&gt;Var3&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 1&lt;/P&gt;&lt;P&gt;Var4&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2&lt;/P&gt;&lt;P&gt;Var5&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;Var103&amp;nbsp; &amp;nbsp; &amp;nbsp;100&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to switch Var3 to Var103&amp;nbsp; in Table1 with the 1-100 from Table2, so as to be able to reference them as an array.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then once I finish manipulating the array as needed, switch back to Var3 to Var103?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or simpler, is there a way to fill the missing values in Table1 with '.' values, without referencing each variable?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 May 2020 14:35:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-non-sequential-variable-names-to-integers-to-reference/m-p/649583#M194770</guid>
      <dc:creator>mcook</dc:creator>
      <dc:date>2020-05-21T14:35:15Z</dc:date>
    </item>
    <item>
      <title>Re: Changing non-sequential variable names to integers to reference them in array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-non-sequential-variable-names-to-integers-to-reference/m-p/649586#M194772</link>
      <description>Edit:&lt;BR /&gt;&lt;BR /&gt;The Array would be Var4-Var103</description>
      <pubDate>Thu, 21 May 2020 14:37:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-non-sequential-variable-names-to-integers-to-reference/m-p/649586#M194772</guid>
      <dc:creator>mcook</dc:creator>
      <dc:date>2020-05-21T14:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: Changing non-sequential variable names to integers to reference them in array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-non-sequential-variable-names-to-integers-to-reference/m-p/649588#M194773</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;Where Variables Var3 through Var103 are alpha-numeric in alphabetical order, But their alphabetic prefixes are different. So i cannot reference them as Var3-Var103 to create an array.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;Does this mean that the variables are not really named Var3 to Var103, but might be something like pig4, duck5, goose6, gorilla7, giraffe8, ..., monkey103?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;If so, to create an array, you could use&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;array x pig4--monkey103;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 May 2020 14:39:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-non-sequential-variable-names-to-integers-to-reference/m-p/649588#M194773</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-05-21T14:39:19Z</dc:date>
    </item>
    <item>
      <title>Re: Changing non-sequential variable names to integers to reference them in array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-non-sequential-variable-names-to-integers-to-reference/m-p/649602#M194782</link>
      <description>&lt;P&gt;I would suggest that changing a variable name may be a tad confusing if you don't use the data set for awhile or share the data with others (especially ).&lt;/P&gt;
&lt;P&gt;If you only have a few gaps in your integer sequence you could use something like&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;arrray v&amp;nbsp;&amp;nbsp; var1-var27 var29-var99 var103;&lt;/P&gt;
&lt;P&gt;Most places a variable "list" can be used can accept gaps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the variables are contiguous (next to each other in the data set or have sequential variable order numbers in Proc Contents output) then the double dash &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt; suggests is appropriate as well as working for non-common names for all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And if there are no other variables that start with the same name you can use the colon list generator. &amp;nbsp; var: would a list of all variables whose names start with var.&lt;/P&gt;</description>
      <pubDate>Thu, 21 May 2020 15:14:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-non-sequential-variable-names-to-integers-to-reference/m-p/649602#M194782</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-05-21T15:14:32Z</dc:date>
    </item>
    <item>
      <title>Re: Changing non-sequential variable names to integers to reference them in array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-non-sequential-variable-names-to-integers-to-reference/m-p/649627#M194794</link>
      <description>No, they do not have sequential numbers in proc contents. How might i go about achieving that?</description>
      <pubDate>Thu, 21 May 2020 16:24:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-non-sequential-variable-names-to-integers-to-reference/m-p/649627#M194794</guid>
      <dc:creator>mcook</dc:creator>
      <dc:date>2020-05-21T16:24:51Z</dc:date>
    </item>
    <item>
      <title>Re: Changing non-sequential variable names to integers to reference them in array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-non-sequential-variable-names-to-integers-to-reference/m-p/649636#M194798</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/319809"&gt;@mcook&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;No, they do not have sequential numbers in proc contents. How might i go about achieving that?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Show us your proc contents variables list information and indicate which variables you need.&lt;/P&gt;</description>
      <pubDate>Thu, 21 May 2020 16:52:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-non-sequential-variable-names-to-integers-to-reference/m-p/649636#M194798</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-05-21T16:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: Changing non-sequential variable names to integers to reference them in array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Changing-non-sequential-variable-names-to-integers-to-reference/m-p/649639#M194799</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/319809"&gt;@mcook&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;No, they do not have sequential numbers in proc contents. How might i go about achieving that?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;As long as the variables are sequential in your SAS data set, the numbers in the variable names are not meaningful. The double-dash variable list works in the case of sequential variables.&lt;/P&gt;</description>
      <pubDate>Thu, 21 May 2020 16:59:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Changing-non-sequential-variable-names-to-integers-to-reference/m-p/649639#M194799</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-05-21T16:59:47Z</dc:date>
    </item>
  </channel>
</rss>

