<?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 Explanation of Select  processing vs. if-then processing in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Explanation-of-Select-processing-vs-if-then-processing/m-p/75350#M16225</link>
    <description>Hi everyone.&lt;BR /&gt;
&lt;BR /&gt;
I am working on a presentation of the Select statement vs. if-then/else conditional logic, and I am trying to find a paper or explanation of how SAS processes if-then logic differently than the select statement. If anyone knows of a good SUGI paper or another explanation online, that would be great.&lt;BR /&gt;
&lt;BR /&gt;
Otherwise, here's the gist of what I'm comparing.&lt;BR /&gt;
&lt;BR /&gt;
Compare these two examples.&lt;BR /&gt;
&lt;BR /&gt;
data one;&lt;BR /&gt;
 set old;&lt;BR /&gt;
  select (var);&lt;BR /&gt;
    when (1) flag = 1;&lt;BR /&gt;
    when (2) flag = 2;&lt;BR /&gt;
    otherwise flag = 3;&lt;BR /&gt;
   end; * end select;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data two;&lt;BR /&gt;
  set old;&lt;BR /&gt;
   if var = 1 then flag = 1;&lt;BR /&gt;
    else if var = 2 then flag = 2;&lt;BR /&gt;
    else flag = 3;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
My understanding of the second example is that SAS will process line by line, checking first if var = 1, then cycling to the top and looking for var = 2, then setting setting flag = 3 for all other lines. &lt;BR /&gt;
&lt;BR /&gt;
I have read from SAS that the select statement can be faster than if-then/else logic, so I'm wondering if anyone can explain how SAS processes the select statement differently than using if-then logic. &lt;BR /&gt;
&lt;BR /&gt;
Thanks!</description>
    <pubDate>Fri, 09 Oct 2009 19:03:35 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-10-09T19:03:35Z</dc:date>
    <item>
      <title>Explanation of Select  processing vs. if-then processing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Explanation-of-Select-processing-vs-if-then-processing/m-p/75350#M16225</link>
      <description>Hi everyone.&lt;BR /&gt;
&lt;BR /&gt;
I am working on a presentation of the Select statement vs. if-then/else conditional logic, and I am trying to find a paper or explanation of how SAS processes if-then logic differently than the select statement. If anyone knows of a good SUGI paper or another explanation online, that would be great.&lt;BR /&gt;
&lt;BR /&gt;
Otherwise, here's the gist of what I'm comparing.&lt;BR /&gt;
&lt;BR /&gt;
Compare these two examples.&lt;BR /&gt;
&lt;BR /&gt;
data one;&lt;BR /&gt;
 set old;&lt;BR /&gt;
  select (var);&lt;BR /&gt;
    when (1) flag = 1;&lt;BR /&gt;
    when (2) flag = 2;&lt;BR /&gt;
    otherwise flag = 3;&lt;BR /&gt;
   end; * end select;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data two;&lt;BR /&gt;
  set old;&lt;BR /&gt;
   if var = 1 then flag = 1;&lt;BR /&gt;
    else if var = 2 then flag = 2;&lt;BR /&gt;
    else flag = 3;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
My understanding of the second example is that SAS will process line by line, checking first if var = 1, then cycling to the top and looking for var = 2, then setting setting flag = 3 for all other lines. &lt;BR /&gt;
&lt;BR /&gt;
I have read from SAS that the select statement can be faster than if-then/else logic, so I'm wondering if anyone can explain how SAS processes the select statement differently than using if-then logic. &lt;BR /&gt;
&lt;BR /&gt;
Thanks!</description>
      <pubDate>Fri, 09 Oct 2009 19:03:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Explanation-of-Select-processing-vs-if-then-processing/m-p/75350#M16225</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-10-09T19:03:35Z</dc:date>
    </item>
    <item>
      <title>Re: Explanation of Select  processing vs. if-then processing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Explanation-of-Select-processing-vs-if-then-processing/m-p/75351#M16226</link>
      <description>I can't that this is an issue any more. Maybe for 10-15 ago, with slower CPU's.&lt;BR /&gt;
Select is easier to code (and maintain), if-then-else offers more flexibility.&lt;BR /&gt;
&lt;BR /&gt;
/Linus</description>
      <pubDate>Mon, 12 Oct 2009 11:32:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Explanation-of-Select-processing-vs-if-then-processing/m-p/75351#M16226</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2009-10-12T11:32:58Z</dc:date>
    </item>
    <item>
      <title>Re: Explanation of Select  processing vs. if-then processing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Explanation-of-Select-processing-vs-if-then-processing/m-p/75352#M16227</link>
      <description>Check this thread posted by me. &lt;BR /&gt;
&lt;BR /&gt;
&lt;A href="http://support.sas.com/forums/thread.jspa?threadID=7030" target="_blank"&gt;http://support.sas.com/forums/thread.jspa?threadID=7030&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thanks &lt;BR /&gt;
Manish</description>
      <pubDate>Fri, 23 Oct 2009 05:55:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Explanation-of-Select-processing-vs-if-then-processing/m-p/75352#M16227</guid>
      <dc:creator>er_awasthi</dc:creator>
      <dc:date>2009-10-23T05:55:51Z</dc:date>
    </item>
  </channel>
</rss>

