<?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 If then else syntax in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/If-then-else-syntax/m-p/413554#M101239</link>
    <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;I wrote the following code;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;if apple=1 and peach=0 then fruit=1;&lt;/P&gt;&lt;P&gt;else if apple=1 and peach=1 then fruit=2;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then when I ran proc freq, all my observations were fruit=1&lt;/P&gt;&lt;P&gt;And I know there are apple=1 and peach=1 in the dataset. Is the syntax wrong in my code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Nov 2017 03:14:05 GMT</pubDate>
    <dc:creator>leahcho</dc:creator>
    <dc:date>2017-11-15T03:14:05Z</dc:date>
    <item>
      <title>If then else syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-else-syntax/m-p/413554#M101239</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;I wrote the following code;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;if apple=1 and peach=0 then fruit=1;&lt;/P&gt;&lt;P&gt;else if apple=1 and peach=1 then fruit=2;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then when I ran proc freq, all my observations were fruit=1&lt;/P&gt;&lt;P&gt;And I know there are apple=1 and peach=1 in the dataset. Is the syntax wrong in my code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2017 03:14:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-else-syntax/m-p/413554#M101239</guid>
      <dc:creator>leahcho</dc:creator>
      <dc:date>2017-11-15T03:14:05Z</dc:date>
    </item>
    <item>
      <title>Re: If then else syntax</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-then-else-syntax/m-p/413555#M101240</link>
      <description>&lt;P&gt;Post the LOG of the step.&lt;/P&gt;
&lt;P&gt;Perhaps your data step failed for some other reason.&lt;/P&gt;
&lt;P&gt;Perhaps you analyzed some other dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Make sure the values of the variables are actually integers.&amp;nbsp; Perhaps you have a values like 0.99999999999 that will print as 1 in most cases, but will not test as being equal to 1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Nov 2017 03:23:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-then-else-syntax/m-p/413555#M101240</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-11-15T03:23:45Z</dc:date>
    </item>
  </channel>
</rss>

