<?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 Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Array-Help/m-p/87429#M24956</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Below code should do what you're after:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt; infile datalines dsd truncover;&lt;BR /&gt; input customer account_type_201102:$20. account_type_201103:$20. account_type_201104:$20.;&lt;BR /&gt;datalines;&lt;BR /&gt;1,,TBA,MultiSite&lt;BR /&gt;2,SmallEnterprise,SmallEnterprise,MediumEnterprise&lt;BR /&gt;3,TBA,TBA,TBA&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format;&lt;BR /&gt;&amp;nbsp; value $NoTBA (min=20)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'TBA'=' '&lt;BR /&gt;&amp;nbsp; ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want(drop=_:);&lt;BR /&gt;&amp;nbsp; set have;&lt;BR /&gt;&amp;nbsp; format account_type_acq $20.;&lt;BR /&gt;&amp;nbsp; array segmentarray &lt;LI&gt; account_type_: ;&lt;BR /&gt;&amp;nbsp; do _i=1 to dim(segmentarray);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if put(segmentarray(_i),$NoTBA.) ne '' then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; account_type_acq=put(segmentarray(_i),$NoTBA.);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; leave;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;BR /&gt;&amp;nbsp; end;&lt;BR /&gt;&amp;nbsp; if account_type_acq='' then account_type_acq=coalescec(of segmentarray(*));&lt;BR /&gt;run;&lt;/LI&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print data=want;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 18 Apr 2012 10:31:42 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2012-04-18T10:31:42Z</dc:date>
    <item>
      <title>Array Help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Array-Help/m-p/87426#M24953</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have created the following array to identify the first valid segment value for a customers, here is a data example of what it does;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="width: 100%; border: #000000 1px solid;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;"&gt;&lt;STRONG&gt;customer&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;"&gt;&lt;STRONG&gt;account_type_201102&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;"&gt;&lt;STRONG&gt;&lt;STRONG&gt;account_type_201103&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;"&gt;&lt;STRONG&gt;&lt;STRONG&gt;account_type_201104&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;STRONG&gt;TBA&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;MultiSite&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;&lt;STRONG&gt;SmallEnterprise&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;SmallEnterprise&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;MediumEnterprise&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;TBA&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;TBA&lt;/TD&gt;&lt;TD&gt;TBA&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; folder.test&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;(&lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;compress&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;=yes);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;set&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; work.BadFlags;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;format&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; account_type_acq &lt;/SPAN&gt;&lt;SPAN style="background: white; color: teal; font-family: 'Courier New';"&gt;$20.&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;array&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; segmentarray &lt;LI&gt; account_type_: ;&lt;/LI&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;do&lt;/SPAN&gt; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;while&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; (account_type_acq=&lt;/SPAN&gt;&lt;SPAN style="background: white; color: purple; font-family: 'Courier New';"&gt;''&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;account_type_acq=segmentarray&lt;I&gt;;&lt;/I&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;i+&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;end&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;So a variable is created (account_type_acq) to identify the first allocated segment. So in the case above, customer 1 is "TBA", 2 is "Small Enterprise" etc. The array will check every column until it hits the end, there is no array range as you can see, this is because every month, a file is created to indentify the customer segment. So for new customers that were acquired earlier, the newest file will have the segment.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;My question is, I want the array to skip "TBA" also and only select a value that is "SmallEnterprise"/"MediumEnterprise"/"Multisite". Currently it skips the blank values but I also want it to skip "TBA". I've tried adding an OR statement to the do while but I receive an error message "Subscript out of range".&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;any help will be appreciated.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Apr 2012 08:26:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Array-Help/m-p/87426#M24953</guid>
      <dc:creator>thegraduate</dc:creator>
      <dc:date>2012-04-18T08:26:23Z</dc:date>
    </item>
    <item>
      <title>Re: Array Help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Array-Help/m-p/87427#M24954</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this..Hope its helps...please post the output you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data one;&lt;/P&gt;&lt;P&gt;input customer account_type_201102 $ 5-20 account_type_201103 $ 22-37 account_type_201104 $ 41-57;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TBA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MultiSite&lt;/P&gt;&lt;P&gt;2 SmallEnterprise SmallEnterprise MediumEnterprise&lt;/P&gt;&lt;P&gt;3 TBA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TBA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TBA&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;data tst;&lt;/P&gt;&lt;P&gt;set work.one;&lt;/P&gt;&lt;P&gt;format account_type_acq $20.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; array segmentarray &lt;LI&gt; account_type_: ;&lt;/LI&gt;&lt;/P&gt;&lt;P&gt;do i=1 to dim(segmentarray);&lt;/P&gt;&lt;P&gt;if segmentarray&lt;I&gt; ='' or segmentarray&lt;I&gt;='TBA' then&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;account_type_acq='';&lt;/P&gt;&lt;P&gt;else account_type_acq=segmentarray&lt;I&gt;;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Shiva&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Apr 2012 08:48:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Array-Help/m-p/87427#M24954</guid>
      <dc:creator>shivas</dc:creator>
      <dc:date>2012-04-18T08:48:50Z</dc:date>
    </item>
    <item>
      <title>Re: Array Help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Array-Help/m-p/87428#M24955</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Shiva,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That didn't work as if it detects "TBA" at all in any of the months, it blanks out the value.;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Customer&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Account_Type_201101&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Account_Type_201102&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Account_Type_201103&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ME&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TBA&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TBA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TBA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TBA&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your code blanks out the segment type for the example above.&amp;nbsp; What I want it to do is to obtain the first valid segment "SE"/"ME"/"MP". But I always want to populate the value, so customer 2 has TBA all the way through, then account_type is TBA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does this makes sense?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Apr 2012 09:09:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Array-Help/m-p/87428#M24955</guid>
      <dc:creator>thegraduate</dc:creator>
      <dc:date>2012-04-18T09:09:54Z</dc:date>
    </item>
    <item>
      <title>Re: Array Help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Array-Help/m-p/87429#M24956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Below code should do what you're after:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt; infile datalines dsd truncover;&lt;BR /&gt; input customer account_type_201102:$20. account_type_201103:$20. account_type_201104:$20.;&lt;BR /&gt;datalines;&lt;BR /&gt;1,,TBA,MultiSite&lt;BR /&gt;2,SmallEnterprise,SmallEnterprise,MediumEnterprise&lt;BR /&gt;3,TBA,TBA,TBA&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc format;&lt;BR /&gt;&amp;nbsp; value $NoTBA (min=20)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'TBA'=' '&lt;BR /&gt;&amp;nbsp; ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want(drop=_:);&lt;BR /&gt;&amp;nbsp; set have;&lt;BR /&gt;&amp;nbsp; format account_type_acq $20.;&lt;BR /&gt;&amp;nbsp; array segmentarray &lt;LI&gt; account_type_: ;&lt;BR /&gt;&amp;nbsp; do _i=1 to dim(segmentarray);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if put(segmentarray(_i),$NoTBA.) ne '' then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; account_type_acq=put(segmentarray(_i),$NoTBA.);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; leave;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;BR /&gt;&amp;nbsp; end;&lt;BR /&gt;&amp;nbsp; if account_type_acq='' then account_type_acq=coalescec(of segmentarray(*));&lt;BR /&gt;run;&lt;/LI&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print data=want;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Apr 2012 10:31:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Array-Help/m-p/87429#M24956</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2012-04-18T10:31:42Z</dc:date>
    </item>
    <item>
      <title>Re: Array Help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Array-Help/m-p/87430#M24957</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I prefer to Hash Table for your this special situation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data have;
infile datalines dsd truncover;
input customer account_type_201102:$20. account_type_201103:$20. account_type_201104:$20.;
datalines;
1,,TBA,MultiSite
2,SmallEnterprise,SmallEnterprise,MediumEnterprise
3,TBA,TBA,TBA
;
run;
data _null_;
if _n_ eq 1 then do;
length type $ 20;
 declare hash ha();
&amp;nbsp; ha.definekey('type');
&amp;nbsp; ha.definedone();
end;
 set have;
 array segmentarray{*} account_type_: ;
 do i=1 to dim(segmentarray);
&amp;nbsp; if ha.check(key:segmentarray{i}) ne 0 and not missing(segmentarray{i}) then do; 
&amp;nbsp;&amp;nbsp; put 'Found A New Value:' segmentarray{i} ;
&amp;nbsp;&amp;nbsp; type=segmentarray{i};ha.add();
&amp;nbsp;&amp;nbsp; leave;
&amp;nbsp;&amp;nbsp; end;
&amp;nbsp; end;
run;


&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Apr 2012 02:56:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Array-Help/m-p/87430#M24957</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-04-19T02:56:11Z</dc:date>
    </item>
    <item>
      <title>Re: Array Help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Array-Help/m-p/87431#M24958</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'd just change the DO loop to:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do until (account_type_acq not in (' ', 'TBA'));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will run the risk of an array subscript out of range, at least in theory.&amp;nbsp; If a CUSTOMER has all blanks and TBAs, and there is no valid account type to be found, you'll get that error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Apr 2012 04:07:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Array-Help/m-p/87431#M24958</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-04-19T04:07:36Z</dc:date>
    </item>
    <item>
      <title>Re: Array Help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Array-Help/m-p/87432#M24959</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the replies, i did find this solution to work;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;format&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; account_type_acq &lt;/SPAN&gt;&lt;SPAN style="background: white; color: teal; font-family: 'Courier New';"&gt;$20.&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;i=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;array&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; segmentarray &lt;LI&gt; account_type_:;&lt;/LI&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;do&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; i=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;to&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; dim(segmentarray) &lt;/SPAN&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;until&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt; (account_type_acq IN(&lt;/SPAN&gt;&lt;SPAN style="background: white; color: purple; font-family: 'Courier New';"&gt;'SE'&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;,&lt;/SPAN&gt;&lt;SPAN style="background: white; color: purple; font-family: 'Courier New';"&gt;'ME'&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;,&lt;/SPAN&gt;&lt;SPAN style="background: white; color: purple; font-family: 'Courier New';"&gt;'MU'&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; account_type_acq=segmentarray&lt;I&gt;;&lt;/I&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;i+&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background: white; color: blue; font-family: 'Courier New';"&gt;end&lt;/SPAN&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="background: white; color: black; font-family: 'Courier New';"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is similiar to what Astounding mentioned but the reverse.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks you all for your input.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Apr 2012 11:20:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Array-Help/m-p/87432#M24959</guid>
      <dc:creator>thegraduate</dc:creator>
      <dc:date>2012-04-19T11:20:56Z</dc:date>
    </item>
    <item>
      <title>Re: Array Help</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Array-Help/m-p/87433#M24960</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is a good idea to combine methods to end the loop.&amp;nbsp; But ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your DO loop will increment i at the bottom of the loop.&amp;nbsp; You should remove this statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i + 1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Otherwise you will be examining just the odd array elements and skipping the even ones.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Apr 2012 12:38:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Array-Help/m-p/87433#M24960</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-04-19T12:38:49Z</dc:date>
    </item>
  </channel>
</rss>

