<?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: Do loops with IF/THEN statements in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Do-loops-with-IF-THEN-statements/m-p/537714#M147929</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    array a a1-a50;
    array b b1-b50;
    array match match1-match50;
    do i=1 to dim(a);
        if a(i)=b(i) then match(i)='Match';
        else match(i)='Error';
    end;
    drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 22 Feb 2019 14:46:52 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2019-02-22T14:46:52Z</dc:date>
    <item>
      <title>Do loops with IF/THEN statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-loops-with-IF-THEN-statements/m-p/537710#M147926</link>
      <description>&lt;P&gt;Hi All&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's another one from me, I&amp;nbsp;hope is easy for you all - a coffee break problem to solve.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have three sets of variables:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A1-A50&lt;/P&gt;&lt;P&gt;B1-B50&amp;nbsp;&lt;/P&gt;&lt;P&gt;and Match1 to Match 50&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm comparing A1 with B1, A2 with B2, and so on, and I want to run the simple process:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If A1=B1 then Match1='Match' else Match1='Error'&lt;/P&gt;&lt;P&gt;If A2=B2 then Match2='Match' else Match2='Error'&lt;/P&gt;&lt;P&gt;and so on.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way to put this into a Do loop? This must be possible I don't want to write this line of code 50 times!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Assistance appreciated.&lt;/P&gt;&lt;P&gt;A&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 14:38:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-loops-with-IF-THEN-statements/m-p/537710#M147926</guid>
      <dc:creator>AJChamberlain</dc:creator>
      <dc:date>2019-02-22T14:38:17Z</dc:date>
    </item>
    <item>
      <title>Re: Do loops with IF/THEN statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-loops-with-IF-THEN-statements/m-p/537713#M147928</link>
      <description>&lt;P&gt;That's what arrays are for:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;array a {50} a1-a50;
......
do i =1 to 50;
  if a{i} = ........&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Feb 2019 14:46:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-loops-with-IF-THEN-statements/m-p/537713#M147928</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-02-22T14:46:40Z</dc:date>
    </item>
    <item>
      <title>Re: Do loops with IF/THEN statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-loops-with-IF-THEN-statements/m-p/537714#M147929</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
    set have;
    array a a1-a50;
    array b b1-b50;
    array match match1-match50;
    do i=1 to dim(a);
        if a(i)=b(i) then match(i)='Match';
        else match(i)='Error';
    end;
    drop i;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Feb 2019 14:46:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-loops-with-IF-THEN-statements/m-p/537714#M147929</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-02-22T14:46:52Z</dc:date>
    </item>
    <item>
      <title>Re: Do loops with IF/THEN statements</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Do-loops-with-IF-THEN-statements/m-p/537716#M147930</link>
      <description>&lt;P&gt;hey i solved this in the other thread lol&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;with a bonus sample dataset as well haha&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 14:50:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Do-loops-with-IF-THEN-statements/m-p/537716#M147930</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-02-22T14:50:03Z</dc:date>
    </item>
  </channel>
</rss>

