<?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 Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Arrays/m-p/438305#M69082</link>
    <description>&lt;P&gt;This doesn't even seem like a situation where arrays are useful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are performing different tasks on each variable in the array. Arrays are useful when you are performing the same task on each variable in the array.&lt;/P&gt;</description>
    <pubDate>Sun, 18 Feb 2018 22:43:47 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2018-02-18T22:43:47Z</dc:date>
    <item>
      <title>Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Arrays/m-p/438301#M69080</link>
      <description>&lt;P&gt;I am trying to use an array to clean my data, I have tried a few different things and nothing seems to really change what I am seeing, either in the data or the log.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;     array optionschar {4}  $ gender
                       Marital_Status
                       Game_Attendance
                       games_attended;
	        do i = 1 to 10;
                       if optionschar{i} = "Male" then optionschar{i} = "M";
                       if optionschar{i} = "m" then optionschar{i} = "M";
                       if optionschar{i} = "Female" then optionschar{i} = "F";
                       if optionschar{i} = "Mar" then optionschar{i} = "M";
                       if optionschar{i} = "Married" then optionschar{i} = "M";
                       if optionschar{i} = "Single" then optionschar{i} = "S";
                       if optionschar{i} = "999" then optionschar{i} = ".";
                       if optionschar{i} = "Four" then optionschar{i} = "4";
        end;
        drop i; 
keep gender Marital_Status Game_Attendance games_attended;
run;        
        &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 18 Feb 2018 22:12:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Arrays/m-p/438301#M69080</guid>
      <dc:creator>Andrew6</dc:creator>
      <dc:date>2018-02-18T22:12:42Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Arrays/m-p/438304#M69081</link>
      <description>&lt;P&gt;why are you looping 10 times when there are only 4 elements in your array. Shouldnt it be&amp;nbsp;&lt;/P&gt;&lt;P&gt;do i=1 to 4;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Feb 2018 22:28:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Arrays/m-p/438304#M69081</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-02-18T22:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Arrays/m-p/438305#M69082</link>
      <description>&lt;P&gt;This doesn't even seem like a situation where arrays are useful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are performing different tasks on each variable in the array. Arrays are useful when you are performing the same task on each variable in the array.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Feb 2018 22:43:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Arrays/m-p/438305#M69082</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-02-18T22:43:47Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Arrays/m-p/438306#M69083</link>
      <description>&lt;P&gt;use proc format and put function&lt;/P&gt;</description>
      <pubDate>Sun, 18 Feb 2018 22:47:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Arrays/m-p/438306#M69083</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-02-18T22:47:33Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Arrays/m-p/438309#M69084</link>
      <description>&lt;P&gt;Thank you both for the insight.&lt;/P&gt;</description>
      <pubDate>Sun, 18 Feb 2018 23:02:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Arrays/m-p/438309#M69084</guid>
      <dc:creator>Andrew6</dc:creator>
      <dc:date>2018-02-18T23:02:19Z</dc:date>
    </item>
    <item>
      <title>Re: Arrays</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Arrays/m-p/438322#M69085</link>
      <description>&lt;P&gt;Check multiple conditions at once using IN instead of the multiple IF statements:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if optionschar{i} = "Male" then optionschar{i} = "M";
if optionschar{i} = "m" then optionschar{i} = "M"&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is the same as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  if optionschar{i} in ("Male", 'm') then optionschar{i} = "M";
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And another suggestion, make everything upper case in your comparison to avoid having to check for m, M, Male and male. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if upcase(gender) in ('M', 'MALE') then gender='M';
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Feb 2018 02:43:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Arrays/m-p/438322#M69085</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-02-19T02:43:29Z</dc:date>
    </item>
  </channel>
</rss>

