<?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 Data STEP &amp;quot;IF&amp;quot; in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Data-STEP-quot-IF-quot/m-p/52532#M11088</link>
    <description>I was surprised that to see that the following code will give no errors&lt;BR /&gt;
&lt;BR /&gt;
DATA X;&lt;BR /&gt;
  set y;&lt;BR /&gt;
&lt;BR /&gt;
if var1 = "1";&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
I have run something similar where var1 is numeric and yet SAS compiles and executes the code without error.  I thought that you could get an error if var1 was defined to be a numeric variable.  Was I wrong about this?</description>
    <pubDate>Tue, 07 Oct 2008 17:15:43 GMT</pubDate>
    <dc:creator>sjm500</dc:creator>
    <dc:date>2008-10-07T17:15:43Z</dc:date>
    <item>
      <title>Data STEP "IF"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-STEP-quot-IF-quot/m-p/52532#M11088</link>
      <description>I was surprised that to see that the following code will give no errors&lt;BR /&gt;
&lt;BR /&gt;
DATA X;&lt;BR /&gt;
  set y;&lt;BR /&gt;
&lt;BR /&gt;
if var1 = "1";&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
I have run something similar where var1 is numeric and yet SAS compiles and executes the code without error.  I thought that you could get an error if var1 was defined to be a numeric variable.  Was I wrong about this?</description>
      <pubDate>Tue, 07 Oct 2008 17:15:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-STEP-quot-IF-quot/m-p/52532#M11088</guid>
      <dc:creator>sjm500</dc:creator>
      <dc:date>2008-10-07T17:15:43Z</dc:date>
    </item>
    <item>
      <title>Re: Data STEP "IF"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-STEP-quot-IF-quot/m-p/52533#M11089</link>
      <description>You will see a SAS NOTE (no ERROR) in your SASLOG indicating that SAS converted character to numeric or vice versa, depending on the condition presented.&lt;BR /&gt;
&lt;BR /&gt;
On the other hand, if you attempt to combine SAS data sets which have same-named variables and different types, you will get a SAS error in the DATA step.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Tue, 07 Oct 2008 17:57:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-STEP-quot-IF-quot/m-p/52533#M11089</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2008-10-07T17:57:39Z</dc:date>
    </item>
    <item>
      <title>Re: Data STEP "IF"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-STEP-quot-IF-quot/m-p/52534#M11090</link>
      <description>I understand that but how come SAS allows the IF statement to operate normally and give you the correct results even though VAR1 is a numeric type and I am using a string "4" in it to subset the data set.  Shouldn't it have detected that VAR1 was numeric and therefore I cannot use the string "4" with VAR1.  I found that behavior very strange. Maybe it was there all the time and now I am just noticing.&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: sjm500

Message was edited by: sjm500</description>
      <pubDate>Tue, 07 Oct 2008 18:29:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-STEP-quot-IF-quot/m-p/52534#M11090</guid>
      <dc:creator>sjm500</dc:creator>
      <dc:date>2008-10-07T18:29:13Z</dc:date>
    </item>
    <item>
      <title>Re: Data STEP "IF"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Data-STEP-quot-IF-quot/m-p/52535#M11091</link>
      <description>Yes, what you are seeing is SAS normal behavior.  &lt;BR /&gt;
&lt;BR /&gt;
Again, the SASLOG NOTE is the only indication, as demonstrated below:&lt;BR /&gt;
&lt;BR /&gt;
1    data _null_;&lt;BR /&gt;
2    if 1 = '1' then putlog 'We have a winner!';&lt;BR /&gt;
3    run;&lt;BR /&gt;
&lt;BR /&gt;
NOTE: Character values have been converted to numeric values at the places given by:&lt;BR /&gt;
      (Line):(Column).&lt;BR /&gt;
      2:8&lt;BR /&gt;
We have a winner!&lt;BR /&gt;
NOTE: DATA statement used (Total process time):&lt;BR /&gt;
      real time           0.00 seconds&lt;BR /&gt;
      cpu time            0.00 seconds&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Tue, 07 Oct 2008 18:44:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Data-STEP-quot-IF-quot/m-p/52535#M11091</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2008-10-07T18:44:20Z</dc:date>
    </item>
  </channel>
</rss>

