<?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: declare another array with existing array in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/declare-another-array-with-existing-array/m-p/711365#M219131</link>
    <description>&lt;P&gt;Like the other responders, I am unsure what you actually want to do and what fails.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The subject title however leads my mind to the implicit array, which can be created using other arrays. See a small example below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
   array a a1-a5;
   array b b1-b5;
   array ab a b;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 14 Jan 2021 08:22:32 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2021-01-14T08:22:32Z</dc:date>
    <item>
      <title>declare another array with existing array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/declare-another-array-with-existing-array/m-p/711346#M219116</link>
      <description>&lt;P&gt;I wonder how to make use of the existing array to create another array. thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro test(varlist)&lt;BR /&gt;data test;
set test;
array var_arr (*) &amp;amp;varlist;&lt;BR /&gt;array var_arr2 (*) &amp;amp;varlist_1;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;but it did not work...&lt;/P&gt;&lt;P&gt;I want to declare the following with var_arr(*):&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;array var_arr2 (*) a_1 b_1 c_1;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;thank you very much&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 06:20:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/declare-another-array-with-existing-array/m-p/711346#M219116</guid>
      <dc:creator>meichan1128</dc:creator>
      <dc:date>2021-01-14T06:20:40Z</dc:date>
    </item>
    <item>
      <title>Re: declare another array with existing array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/declare-another-array-with-existing-array/m-p/711348#M219117</link>
      <description>&lt;P&gt;An array is only a shortcut to access existing variables. Arrays can have more than one dimension, which is maybe what you want/need. The array statement is, of course, well &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.5&amp;amp;docsetId=lestmtsref&amp;amp;docsetTarget=p08do6szetrxe2n136ush727sbuo.htm" target="_self"&gt;documented&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 06:27:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/declare-another-array-with-existing-array/m-p/711348#M219117</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-01-14T06:27:10Z</dc:date>
    </item>
    <item>
      <title>Re: declare another array with existing array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/declare-another-array-with-existing-array/m-p/711351#M219120</link>
      <description>sorry it doesnt,,,,</description>
      <pubDate>Thu, 14 Jan 2021 06:39:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/declare-another-array-with-existing-array/m-p/711351#M219120</guid>
      <dc:creator>meichan1128</dc:creator>
      <dc:date>2021-01-14T06:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: declare another array with existing array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/declare-another-array-with-existing-array/m-p/711355#M219123</link>
      <description>&lt;P&gt;1) What variables should be assigned to each of the two arrays you want ?&lt;/P&gt;
&lt;P&gt;2) You are using macro variable&amp;nbsp;&lt;STRONG&gt;&amp;amp;varlist_1&lt;/STRONG&gt; which was not defined.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; You probably wanted to add suffix&amp;nbsp;&lt;STRONG&gt;_1&amp;nbsp;&lt;/STRONG&gt;to each member of the list, then you have to&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; create a macro loop to create the new array as in next tested code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mprint;
%macro test(varlist);
  data _null_;
   set test;
    array var_arr1   {*} &amp;amp;varlist;
    array var_arr2 {*}
         %let n = %sysfunc(countw(&amp;amp;varlist));
         %do i=1 %to &amp;amp;n;
                 %scan(&amp;amp;varlist,&amp;amp;i)_1
          %end;
          ;   /* closing the array statement */
  run cancel;
%mend;
%test(a b c d);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Jan 2021 07:22:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/declare-another-array-with-existing-array/m-p/711355#M219123</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2021-01-14T07:22:48Z</dc:date>
    </item>
    <item>
      <title>Re: declare another array with existing array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/declare-another-array-with-existing-array/m-p/711362#M219129</link>
      <description>&lt;P&gt;How do you build varlist1? It may be easiest to build the "new" list in parallel.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you expect to do this frequently then you need to build a tool that will do so.&lt;/P&gt;
&lt;P&gt;Note that you very cleverly did not show us what your existing varlist actually looks like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming you started with Varlist = a b c&amp;nbsp; then consider:&lt;/P&gt;
&lt;PRE&gt;%let varlist=a b c;
data _null_;
   x="&amp;amp;varlist.";
   length y $ 200;
   do i= 1 to countw(x);
      word= catx('_',scan(x,i),'1');
      y=catx(' ',y,word);
   end;
   call symputx ('varlist_1',y);
run;

%put New list is: &amp;amp;varlist_1.;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW: Doesn't work is awful vague.&lt;BR /&gt;&lt;BR /&gt;Are there errors in the log?: Post the code and log in a code box opened with the &amp;lt;&amp;gt; to maintain formatting of error messages.&lt;BR /&gt;&lt;BR /&gt;No output? Post any log in a code box.&lt;BR /&gt;&lt;BR /&gt;Unexpected output? Provide input data in the form of data step code pasted into a code box, the actual results and the expected results. Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank" rel="noopener"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the &amp;lt;/&amp;gt; icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 09:18:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/declare-another-array-with-existing-array/m-p/711362#M219129</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-01-14T09:18:43Z</dc:date>
    </item>
    <item>
      <title>Re: declare another array with existing array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/declare-another-array-with-existing-array/m-p/711363#M219130</link>
      <description>&lt;P&gt;Please explain how you plan to use the array you think you need.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 08:10:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/declare-another-array-with-existing-array/m-p/711363#M219130</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-01-14T08:10:57Z</dc:date>
    </item>
    <item>
      <title>Re: declare another array with existing array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/declare-another-array-with-existing-array/m-p/711365#M219131</link>
      <description>&lt;P&gt;Like the other responders, I am unsure what you actually want to do and what fails.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The subject title however leads my mind to the implicit array, which can be created using other arrays. See a small example below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
   array a a1-a5;
   array b b1-b5;
   array ab a b;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Jan 2021 08:22:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/declare-another-array-with-existing-array/m-p/711365#M219131</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-01-14T08:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: declare another array with existing array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/declare-another-array-with-existing-array/m-p/711371#M219137</link>
      <description>&lt;P&gt;Thank you guys for answering my question. After doing some researching,&amp;nbsp; I came up with the following, and solved my problem:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro test(varlist);
	%let varlist_1 = %sysfunc(tranwrd(&amp;amp;varlist, %str( ), %str(_1 )));

	data _null_;	
		set test;
		array var_arr (*) &amp;amp;varlist.;  
		array var_arr2 (*) &amp;amp;varlist_1.;
	run;
%mend;&lt;BR /&gt;&lt;BR /&gt;%let&amp;nbsp;varlist&amp;nbsp;=&amp;nbsp;a&amp;nbsp;b&amp;nbsp;c;&lt;BR /&gt;&lt;BR /&gt;%test(varlist);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 09:00:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/declare-another-array-with-existing-array/m-p/711371#M219137</guid>
      <dc:creator>meichan1128</dc:creator>
      <dc:date>2021-01-14T09:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: declare another array with existing array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/declare-another-array-with-existing-array/m-p/711372#M219138</link>
      <description>i have posted my solution. thank you.</description>
      <pubDate>Thu, 14 Jan 2021 08:55:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/declare-another-array-with-existing-array/m-p/711372#M219138</guid>
      <dc:creator>meichan1128</dc:creator>
      <dc:date>2021-01-14T08:55:17Z</dc:date>
    </item>
    <item>
      <title>Re: declare another array with existing array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/declare-another-array-with-existing-array/m-p/711373#M219139</link>
      <description>i have posted my solution. thank you.&lt;BR /&gt;</description>
      <pubDate>Thu, 14 Jan 2021 08:55:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/declare-another-array-with-existing-array/m-p/711373#M219139</guid>
      <dc:creator>meichan1128</dc:creator>
      <dc:date>2021-01-14T08:55:22Z</dc:date>
    </item>
    <item>
      <title>Re: declare another array with existing array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/declare-another-array-with-existing-array/m-p/711378#M219141</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/283466"&gt;@meichan1128&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you guys for answering my question. After doing some researching,&amp;nbsp; I came up with the following, and solved my problem:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro test(varlist);
	%let varlist_1 = %sysfunc(tranwrd(&amp;amp;varlist, %str( ), %str(_1 )));

	data _null_;	
		set test;
		array var_arr (*) &amp;amp;varlist.;  
		array var_arr2 (*) &amp;amp;varlist_1.;
	run;
%mend;&lt;BR /&gt;&lt;BR /&gt;%let&amp;nbsp;varlist&amp;nbsp;=&amp;nbsp;a&amp;nbsp;b&amp;nbsp;c;&lt;BR /&gt;&lt;BR /&gt;%test(varlist);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Your code will not generate correct code in case you have more then one space between variables as in:&amp;nbsp;&amp;nbsp;&lt;STRONG&gt;%test(a&amp;nbsp; &amp;nbsp;b&amp;nbsp; &amp;nbsp;c);&amp;nbsp;&lt;/STRONG&gt;as it generated the code:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;MPRINT(TEST): array var_arr2 (*) a_1 _1 _1 b_1 _1 _1 c;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have checked with&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;%let varlist_1 = %sysfunc(tranwrd(%sysfunc(compbl(&amp;amp;varlist)), %str( ), %str(_1&lt;/STRONG&gt; )));&lt;BR /&gt;but even then the last variable is still not correct, it generated:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;MPRINT(TEST): array var_arr2 (*) a_1 b_1 c;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 09:34:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/declare-another-array-with-existing-array/m-p/711378#M219141</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2021-01-14T09:34:56Z</dc:date>
    </item>
    <item>
      <title>Re: declare another array with existing array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/declare-another-array-with-existing-array/m-p/711386#M219144</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/283466"&gt;@meichan1128&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you guys for answering my question. After doing some researching,&amp;nbsp; I came up with the following, and solved my problem:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro test(varlist);
	%let varlist_1 = %sysfunc(tranwrd(&amp;amp;varlist, %str( ), %str(_1 )));

	data _null_;	
		set test;
		array var_arr (*) &amp;amp;varlist.;  
		array var_arr2 (*) &amp;amp;varlist_1.;
	run;
%mend;&lt;BR /&gt;&lt;BR /&gt;%let&amp;nbsp;varlist&amp;nbsp;=&amp;nbsp;a&amp;nbsp;b&amp;nbsp;c;&lt;BR /&gt;&lt;BR /&gt;%test(varlist);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This "solution" &lt;STRONG&gt;fails&lt;/STRONG&gt; when your varlist has exactly one element.&lt;/P&gt;
&lt;PRE&gt;%macro dummy(varlist);
	%let varlist_1 = %sysfunc(tranwrd(&amp;amp;varlist, %str( ), %str(_1 )));

%put varlist_1 is: &amp;amp;varlist_1.;

%mend;
%let varlist = a;
%dummy(a);&lt;/PRE&gt;
&lt;P&gt;The result of your approach means that Varlist_1 is exactly the same as Varlist with exactly one element.&lt;/P&gt;
&lt;P&gt;Also, if you ever have more than one space in the middle of the list it fails the intended purpose by creating multiple _1 for each space&lt;/P&gt;
&lt;PRE&gt;%dummy(a  b    c);

yields
varlist_1 is: a_1 _1 b_1 _1 _1 _1 c
&lt;/PRE&gt;
&lt;P&gt;And it fails for your basic approach: the LAST element of varlist from %let varlist= a b c ; is not suffixed.&lt;/P&gt;
&lt;PRE&gt;%let varlist = a b c ;

%dummy(&amp;amp;varlist.);

yields
varlist_1 is: a_1 b_1 c


&lt;/PRE&gt;
&lt;P&gt;This last case is because there is no space after the last character. You can check how the macro processor handles such by:&lt;/P&gt;
&lt;PRE&gt;%let varlist = a b c                        ;

%put &amp;amp;varlist^;&lt;/PRE&gt;
&lt;P&gt;The macro processor ignores trailing blanks. So the result of the %put above is a b c^&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you go back to my example possibly proposed solution you will see that varlist= a&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; b&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c&amp;nbsp;&amp;nbsp; ; yields the expected values. That is because of the way the countw and Scan work by default with repeated delimiters&lt;/P&gt;
&lt;PRE&gt;data _null_;
   x="a   b        c";
   length y $ 200;
   do i= 1 to countw(x);
      item=scan(x,i);
      put item=;
      word= catx('_',scan(x,i),'1');
      put word=;
      y=catx(' ',y,word);
      put y=;
   end;
run;&lt;/PRE&gt;
&lt;P&gt;shows the string being built.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A macro solution could look like:&lt;/P&gt;
&lt;PRE&gt;%macro dummy(varlist);
%local varlist_1;
%let varlist_1=;
%do i=1 %to %sysfunc(countw(&amp;amp;varlist.));
   %let varlist_1 = &amp;amp;varlist_1. %scan(&amp;amp;varlist.,&amp;amp;i)_1;
%end;
%put Varlist_1 is: &amp;amp;varlist_1.;
%mend;

%let varlist = a b c;

%dummy(&amp;amp;varlist.);&lt;/PRE&gt;
&lt;P&gt;If you want to just build the VARLIST_1 macro variable and use it elsewhere change the %local to %global to make it available outside of the %dummy macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jan 2021 01:47:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/declare-another-array-with-existing-array/m-p/711386#M219144</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-01-18T01:47:56Z</dc:date>
    </item>
    <item>
      <title>Re: declare another array with existing array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/declare-another-array-with-existing-array/m-p/711387#M219145</link>
      <description>&lt;P&gt;An alternate solution will be:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro test(varlist);
	%let varlist_1 = %sysfunc(compbl(&amp;amp;varlist));
	%let varlist_2 = %sysfunc(tranwrd(&amp;amp;varlist_1,%str( ),%str(. ))).;
	%let varlist_3 = %sysfunc(tranwrd(&amp;amp;varlist_2, %str(.), %str(_1 )));
	
	%put 1=&amp;amp;varlist_1 2=&amp;amp;varlist_2 3=&amp;amp;varlist_3;
%mend;
options mprint;
%test(a   b   c );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;with the required result (copied from the log):&lt;/P&gt;
&lt;PRE&gt;1=a b c 2=a. b. c. 3=a_1  b_1  c_1&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 09:56:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/declare-another-array-with-existing-array/m-p/711387#M219145</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2021-01-14T09:56:42Z</dc:date>
    </item>
    <item>
      <title>Re: declare another array with existing array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/declare-another-array-with-existing-array/m-p/711468#M219183</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Like the other responders, I am unsure what you actually want to do and what fails.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The subject title however leads my mind to the implicit array, which can be created using other arrays. See a small example below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
   array a a1-a5;
   array b b1-b5;
   array ab a b;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is interesting to me, but I could not get the above code to work like I expected it to.&amp;nbsp; I found this on SASnrd.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data d;
   array a (i) a1-a5  (1:5);
   array b (i) b1-b5  (6:10);
   array ab a b;
 
   do over ab;
      do i=1 to 5;
         put ab=;
      end;
   end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;A href="https://sasnrd.com/sas-array-implicit-explicit/" target="_blank"&gt;Implicit Vs Explicit Array Explained in SAS - SASnrd&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2021 15:05:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/declare-another-array-with-existing-array/m-p/711468#M219183</guid>
      <dc:creator>PhilC</dc:creator>
      <dc:date>2021-01-14T15:05:23Z</dc:date>
    </item>
    <item>
      <title>Re: declare another array with existing array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/declare-another-array-with-existing-array/m-p/711502#M219201</link>
      <description>&lt;P&gt;You left the suffix off the last item in the list.&amp;nbsp; You are calling the macro with just one variable named VARLIST instead of the three you had in the %LET statement.&amp;nbsp; You can use the COMPBL() function to make sure the original list has only one separator between each variable.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro test(varlist);
%local varlist_1;
%let varlist=%sysfunc(compbl(&amp;amp;varlist));
%let varlist_1 = %sysfunc(tranwrd(&amp;amp;varlist, %str( ), %str(_1 )))_1;
data _null_;	
  set test;
  array var_arr &amp;amp;varlist.;  
  array var_arr2 &amp;amp;varlist_1.;
run;
%mend;

%test(a b c);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Jan 2021 17:00:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/declare-another-array-with-existing-array/m-p/711502#M219201</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-01-14T17:00:26Z</dc:date>
    </item>
    <item>
      <title>Re: declare another array with existing array</title>
      <link>https://communities.sas.com/t5/SAS-Programming/declare-another-array-with-existing-array/m-p/711971#M219400</link>
      <description>&lt;P&gt;thank you so much ! this is what exactly I wanted !&lt;/P&gt;</description>
      <pubDate>Sun, 17 Jan 2021 16:43:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/declare-another-array-with-existing-array/m-p/711971#M219400</guid>
      <dc:creator>meichan1128</dc:creator>
      <dc:date>2021-01-17T16:43:48Z</dc:date>
    </item>
  </channel>
</rss>

