<?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: assign variable values to array variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/assign-variable-values-to-array-variable/m-p/788526#M252132</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
DATA want;
set have;
array try {3};
array t test1-test3;
do over t;
 try(_i_)=t;
end;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Basically, you have grouped the existing vars into an array. And what you need is another assignment array to copy the values using indexed loop sequential look up. HTH&lt;/P&gt;</description>
    <pubDate>Wed, 05 Jan 2022 19:30:21 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2022-01-05T19:30:21Z</dc:date>
    <item>
      <title>assign variable values to array variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/assign-variable-values-to-array-variable/m-p/788523#M252130</link>
      <description>&lt;P&gt;In following example, I want to assigned test1 value to try1, test2 value to try2, test3 value to try3.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;DATA have;                     
   input IDnumber $ test1 test2 test3;    
   datalines;           
aa 1 0 0 
bb 0 0 0 
cc 0 0 1
dd 1 1 1
;                             
RUN; 

DATA want;
set have;
array try {3};
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I tried following, but did not work.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;Data want;
                Set have;
                Array try(3) test1-test3;
Run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Desire output should be:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dht115_0-1641410677425.png" style="width: 717px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/67147i317361E5534B0EAC/image-dimensions/717x233?v=v2" width="717" height="233" role="button" title="dht115_0-1641410677425.png" alt="dht115_0-1641410677425.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jan 2022 19:24:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/assign-variable-values-to-array-variable/m-p/788523#M252130</guid>
      <dc:creator>dht115</dc:creator>
      <dc:date>2022-01-05T19:24:57Z</dc:date>
    </item>
    <item>
      <title>Re: assign variable values to array variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/assign-variable-values-to-array-variable/m-p/788526#M252132</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
DATA want;
set have;
array try {3};
array t test1-test3;
do over t;
 try(_i_)=t;
end;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Basically, you have grouped the existing vars into an array. And what you need is another assignment array to copy the values using indexed loop sequential look up. HTH&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jan 2022 19:30:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/assign-variable-values-to-array-variable/m-p/788526#M252132</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2022-01-05T19:30:21Z</dc:date>
    </item>
  </channel>
</rss>

