<?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: Array help in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Array-help/m-p/294173#M61346</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;do i = 1 to dim(qr_array);
  analysis_desc=qr_array{i};
  put analysis_desc;
 end;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The Do loop says to put&lt;STRONG&gt; each variable&lt;/STRONG&gt; in the array on a separate line AND loses the original value of analysid_desc because you overwrite it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you only want tp put out the first then either 1) skip the loop and array&amp;nbsp;and say Put analysis_desc;&lt;/P&gt;
&lt;P&gt;Or only loop once and use&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Put qr_array[i];&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And you have yet to show what your actual final desired output is.&lt;/P&gt;</description>
    <pubDate>Thu, 25 Aug 2016 20:00:18 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2016-08-25T20:00:18Z</dc:date>
    <item>
      <title>Array help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-help/m-p/294149#M61337</link>
      <description>&lt;P&gt;Hi. I'm interested in taking the 3 variables from my QueryRules dataset and creating an array that I can iterate thru array record and assign each of the 3 values to 3 different variables as SAS iterates thru each record in my final QueryRules dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Would it be best to create 3 different arrays or 1 array containing 3 variables? Can anyone help me with the syntax to build this type of SAS object? &amp;nbsp;I'd really appreciate some help here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data QueryRules;
infile cards dsd dlm='|' truncover ;
informat analysis_desc $34. rule $64.;
input analysis_desc $ rule $ rule_order;&lt;BR /&gt;(BUILD ARRAY HERE???)
cards;
ACTUAL DELIVERY DATE MISSING IN IV|A.ACTUAL_DLVRY_DATE IS NULL AND B.ACTUAL_DLVRY_DATE IS NOT NULL|1
ACTUAL DELIVERY DATE LATER IN IV|A.ACTUAL_DLVRY_DATE &amp;gt; B.ACTUAL_DLVRY_DATE|1.5
run;&lt;/CODE&gt;&lt;CODE class=" language-sas"&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
 set QueryRules end=eof;
 by Rule_Order;
 file '/home/ssbuechl/myfile.txt';
 the_analysis_desc= (somehow reference an array here to assign each array value) ;
 the_rule= (somehow reference an array here to assign each array value) ;
 the_rule_order= (somehow reference an array here to assign each array value) ;
 put the_rule the_rule_order;
 run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 25 Aug 2016 19:04:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-help/m-p/294149#M61337</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2016-08-25T19:04:56Z</dc:date>
    </item>
    <item>
      <title>Re: Array help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-help/m-p/294157#M61338</link>
      <description>&lt;P&gt;Please post sample data regarding input and desired output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS. As someone mentioned before, whatever process you're working on regarding rules seems very very cumbersome.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2016 19:22:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-help/m-p/294157#M61338</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-08-25T19:22:20Z</dc:date>
    </item>
    <item>
      <title>Re: Array help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-help/m-p/294165#M61341</link>
      <description>&lt;P&gt;Ok, here's my sample data and I think I have an array working, but the Put statement is actually putting out all 3 columns of the array. I don't seem to have control over individual columns.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;rsubmit;

data QueryRules;
infile cards dsd dlm='|' truncover ;
informat analysis_desc $34. rule $64.;
input analysis_desc $ rule $ rule_order $;
cards;
ACTUAL DELIVERY DATE MISSING IN IV|A.ACTUAL_DLVRY_DATE IS NULL AND B.ACTUAL_DLVRY_DATE IS NOT NULL|1
ACTUAL DELIVERY DATE LATER IN IV|A.ACTUAL_DLVRY_DATE &amp;gt; B.ACTUAL_DLVRY_DATE|1.5
run;

data _null_;
 set QueryRules end=eof;
 by Rule_Order;
 file '/home/ssbuechl/myfile.txt';
 array qr_array {3} $ 36 analysis_desc rule rule_order;
 do i = 1 to dim(qr_array);
  analysis_desc=qr_array{i};
  put analysis_desc;
 end;

 run;

 endrsubmit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's outputing:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ACTUAL DELIVERY DATE MISSING IN IV
A.ACTUAL_DLVRY_DATE IS NULL AND B.
1
ACTUAL DELIVERY DATE LATER IN IV
A.ACTUAL_DLVRY_DATE &amp;gt; B.ACTUAL_DLV
1.5&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;My desired output in this case would be:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ACTUAL DELIVERY DATE MISSING IN IV
ACTUAL DELIVERY DATE LATER IN IV&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2016 19:51:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-help/m-p/294165#M61341</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2016-08-25T19:51:20Z</dc:date>
    </item>
    <item>
      <title>Re: Array help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-help/m-p/294171#M61345</link>
      <description>&lt;P&gt;if i=1 then put ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not sure what you're expecting from the array.&lt;/P&gt;
&lt;P&gt;If you only want to put one variable why create the array in the first place.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2016 19:58:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-help/m-p/294171#M61345</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-08-25T19:58:36Z</dc:date>
    </item>
    <item>
      <title>Re: Array help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-help/m-p/294173#M61346</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;do i = 1 to dim(qr_array);
  analysis_desc=qr_array{i};
  put analysis_desc;
 end;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The Do loop says to put&lt;STRONG&gt; each variable&lt;/STRONG&gt; in the array on a separate line AND loses the original value of analysid_desc because you overwrite it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you only want tp put out the first then either 1) skip the loop and array&amp;nbsp;and say Put analysis_desc;&lt;/P&gt;
&lt;P&gt;Or only loop once and use&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Put qr_array[i];&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And you have yet to show what your actual final desired output is.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2016 20:00:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-help/m-p/294173#M61346</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-08-25T20:00:18Z</dc:date>
    </item>
    <item>
      <title>Re: Array help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-help/m-p/294174#M61347</link>
      <description>&lt;P&gt;Got it! &amp;nbsp;Is there a better way to do what I'm doing below?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;rsubmit;

data QueryRules;
infile cards dsd dlm='|' truncover ;
informat analysis_desc $34. rule $64.;
input analysis_desc $ rule $ rule_order $;
cards;
ACTUAL DELIVERY DATE MISSING IN IV|A.ACTUAL_DLVRY_DATE IS NULL AND B.ACTUAL_DLVRY_DATE IS NOT NULL|1
ACTUAL DELIVERY DATE LATER IN IV|A.ACTUAL_DLVRY_DATE &amp;gt; B.ACTUAL_DLVRY_DATE|1.5
run;



data _null_;
 set QueryRules end=eof;
 by Rule_Order;
 file '/home/ssbuechl/myfile.txt';

/*Explicit, Nested*/
array analysis_desc_array {1} $ 35 analysis_desc;
array rule_array {1} $ 65 rule;
array rule_order_array {1} $ 5 rule_order;
do i = 1 to dim(analysis_desc_array);
	do j = 1 to dim(rule_array);
		do k = 1 to dim(rule_order_array);
			analysis_desc=analysis_desc_array{i};
			rule=rule_array{j};
			rule_order=rule_order_array{k};
			put analysis_desc rule rule_order;
		end;
	end;
end;

run;

endrsubmit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ACTUAL DELIVERY DATE MISSING IN IV A.ACTUAL_DLVRY_DATE IS NULL AND B.ACTUAL_DLVRY_DATE IS NOT NULL 1
ACTUAL DELIVERY DATE LATER IN IV A.ACTUAL_DLVRY_DATE &amp;gt; B.ACTUAL_DLVRY_DATE 1.5&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2016 20:06:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-help/m-p/294174#M61347</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2016-08-25T20:06:41Z</dc:date>
    </item>
    <item>
      <title>Re: Array help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Array-help/m-p/294177#M61348</link>
      <description>&lt;P&gt;data _null_;&lt;BR /&gt; set QueryRules end=eof;&lt;BR /&gt; by Rule_Order;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt; put analysis_desc rule rule_order;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2016 20:08:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Array-help/m-p/294177#M61348</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-08-25T20:08:17Z</dc:date>
    </item>
  </channel>
</rss>

