<?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: Controlling Variable Suffix by Creating New Variables with an Array in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Controlling-Variable-Suffix-by-Creating-New-Variables-with-an/m-p/287249#M59068</link>
    <description>&lt;P&gt;Try the following, though I would have thought that P0-P100 would work.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Array p_(0:100) p0 p1-p100;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 26 Jul 2016 15:37:47 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-07-26T15:37:47Z</dc:date>
    <item>
      <title>Controlling Variable Suffix by Creating New Variables with an Array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Controlling-Variable-Suffix-by-Creating-New-Variables-with-an/m-p/287243#M59067</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to create new variables with an array statement that contain suffixes that match from a previously referenced array statement. This is my code:&lt;/P&gt;&lt;PRE&gt;DATA BLAH_F7;
	SET BLAH_F;
	ARRAY A[0:100]F_0--F_100;
	ARRAY P_[0:100]P_0--P_100;
		DO I=0 TO 100;
		P_(I)=A(I)/F_TOTAL;
	END;
	DROP I;
RUN;&lt;/PRE&gt;&lt;P&gt;When I run this code, the array creates variables P_1 to P_101 instead of from P_0 to P_100, which is what I want (as I am trying to match to the F_0 to F_100 variables). Anyone have any suggestions? If this isn't possible using an array statement, I'd still be interested in hearing the simplest way to change these P_1 to P_101 variables to P_0 to P_100.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2016 15:35:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Controlling-Variable-Suffix-by-Creating-New-Variables-with-an/m-p/287243#M59067</guid>
      <dc:creator>kevinmc87</dc:creator>
      <dc:date>2016-07-26T15:35:30Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling Variable Suffix by Creating New Variables with an Array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Controlling-Variable-Suffix-by-Creating-New-Variables-with-an/m-p/287249#M59068</link>
      <description>&lt;P&gt;Try the following, though I would have thought that P0-P100 would work.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Array p_(0:100) p0 p1-p100;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2016 15:37:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Controlling-Variable-Suffix-by-Creating-New-Variables-with-an/m-p/287249#M59068</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-07-26T15:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling Variable Suffix by Creating New Variables with an Array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Controlling-Variable-Suffix-by-Creating-New-Variables-with-an/m-p/287251#M59070</link>
      <description>&lt;P&gt;Thanks, this solution works. I guess P_0 needs to be explicitly stated since this is an array statement that isn't referencing any previously exisiting variables? I'm a little confused by why&amp;nbsp;this works:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Array p_(0:100) p0 p1-p100;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;but this doesn't work:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Array p_(0:100) p0-p100;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks for your help!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2016 15:43:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Controlling-Variable-Suffix-by-Creating-New-Variables-with-an/m-p/287251#M59070</guid>
      <dc:creator>kevinmc87</dc:creator>
      <dc:date>2016-07-26T15:43:51Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling Variable Suffix by Creating New Variables with an Array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Controlling-Variable-Suffix-by-Creating-New-Variables-with-an/m-p/287254#M59071</link>
      <description>&lt;P&gt;Both of those should work.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The piece that doesn't work is the double dash.&amp;nbsp; For SAS to interpret the double dash properly, the variables must already exist and cannot be created by the ARRAY statement.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2016 15:50:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Controlling-Variable-Suffix-by-Creating-New-Variables-with-an/m-p/287254#M59071</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-07-26T15:50:06Z</dc:date>
    </item>
    <item>
      <title>Re: Controlling Variable Suffix by Creating New Variables with an Array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Controlling-Variable-Suffix-by-Creating-New-Variables-with-an/m-p/287259#M59073</link>
      <description>&lt;P&gt;Thanks, Astouding. I did not realize this.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2016 16:06:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Controlling-Variable-Suffix-by-Creating-New-Variables-with-an/m-p/287259#M59073</guid>
      <dc:creator>kevinmc87</dc:creator>
      <dc:date>2016-07-26T16:06:09Z</dc:date>
    </item>
  </channel>
</rss>

