<?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: Arrays in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/520984#M141324</link>
    <description>&lt;P&gt;perfect ..&amp;nbsp; thank you !&lt;/P&gt;</description>
    <pubDate>Wed, 12 Dec 2018 20:28:08 GMT</pubDate>
    <dc:creator>Rampsas1</dc:creator>
    <dc:date>2018-12-12T20:28:08Z</dc:date>
    <item>
      <title>Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/520942#M141307</link>
      <description>&lt;P&gt;Looking for insight into using 'dim' of the first array to define the number of elements in a second array.&lt;BR /&gt;The scenario is when we don't know the number of variables in the raw data and/or want SAS to count them for us&lt;BR /&gt;The question is in section 2) below but wanted to provide some context to my inquiry .. hope it's clear enough&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Raw Data:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data raw_data; 
input fahrenheit1-fahrenheit5;  
datalines;	
100 75 50 25 0
;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;1) Array using {*} and dim for the fahrenheit_array but using celsius1-celsius5 to define the elements of celsius_array&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test (drop=i);
set raw_data;
array fahrenheit_array {*} _all_;
array celsius_array {*} celsius1-celsius5; /* &amp;lt;&amp;lt; initial 'blank' elements BASED ON THE KNOWN 5 VARIABLES*/
do i = 1 to dim(fahrenheit_array); 
celsius_array{i} = 5/9*(fahrenheit_array{i} - 32); /* &amp;lt;&amp;lt; element values defined*/
end; 
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;2) How can we define the number of variables needed for the celsius_array based on dim(fahrenheit_array) ?????&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test (drop=i);
set raw_data;
array fahrenheit_array {*} _all_;
array celsius_array {*} var1-var ???; /* &amp;lt;&amp;lt; HOW CAN WE DEFINE THE NUMBER OF VARIABLES HERE BASED ON DIM(FAHRENHEIT_ARRAY) ??? */
do i = 1 to dim(fahrenheit_array); 
celsius_array{i} = 5/9*(fahrenheit_array{i} - 32);
end; 
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;many thanks&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2018 18:46:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/520942#M141307</guid>
      <dc:creator>Rampsas1</dc:creator>
      <dc:date>2018-12-12T18:46:04Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/520954#M141310</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data raw_data; 
input fahrenheit1-fahrenheit5;  
datalines;	
100 75 50 25 0
;

data _null_;
set raw_data;
array fahrenheit_array {*} _all_ ;
call symputx('n',dim(fahrenheit_array));
stop;
run;
%put &amp;amp;n;

data test (drop=i);
set raw_data;
array fahrenheit_array {*} _all_;
array celsius_array {&amp;amp;n} ; /* call the macrovar n that has the num elements of the array */
do i = 1 to dim(fahrenheit_array); 
celsius_array{i} = 5/9*(fahrenheit_array{i} - 32);
end; 
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Dec 2018 18:59:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/520954#M141310</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-12-12T18:59:38Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/520984#M141324</link>
      <description>&lt;P&gt;perfect ..&amp;nbsp; thank you !&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2018 20:28:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Arrays/m-p/520984#M141324</guid>
      <dc:creator>Rampsas1</dc:creator>
      <dc:date>2018-12-12T20:28:08Z</dc:date>
    </item>
  </channel>
</rss>

