<?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: If Then statement, output is strange -not getting desired one in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/If-Then-statement-output-is-strange-not-getting-desired-one/m-p/216714#M53342</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The condition (LEVEL=2 or 3) is the same as ((LEVEL=2) or 3). Since 3 is always true this condition is always true.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 30 Jun 2015 14:35:53 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2015-06-30T14:35:53Z</dc:date>
    <item>
      <title>If Then statement, output is strange -not getting desired one</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/If-Then-statement-output-is-strange-not-getting-desired-one/m-p/216712#M53340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Folks, plz help me with the following program:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data chk_10;&lt;/P&gt;&lt;P&gt;input sno name $ level;&lt;/P&gt;&lt;P&gt;if level = . then exp = 'unknown'; &lt;/P&gt;&lt;P&gt;else if level = 1 then exp = 'low';&lt;/P&gt;&lt;P&gt;else if level = 2 or 3 then exp = 'medium';&lt;/P&gt;&lt;P&gt;else exp = 'high';&lt;/P&gt;&lt;P&gt; datalines;&lt;/P&gt;&lt;P&gt; 1 Frank 1&lt;/P&gt;&lt;P&gt; 2 John 2&lt;/P&gt;&lt;P&gt; 3 sui 2&lt;/P&gt;&lt;P&gt; 4 sose 1&lt;/P&gt;&lt;P&gt; 5 burt 4&lt;/P&gt;&lt;P&gt; 6 kelly .&lt;/P&gt;&lt;P&gt; 7 juan 1&lt;/P&gt;&lt;P&gt; ;&lt;/P&gt;&lt;P&gt; run;&lt;/P&gt;&lt;P&gt; proc print data = chk_10;&lt;/P&gt;&lt;P&gt; title 'chk1-0';&lt;/P&gt;&lt;P&gt; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want in output that for the observation, which has level value as 4, i should get exp = 'high'--&lt;/P&gt;&lt;P&gt;but output is not showing that. in output - for level 4, exp is coming to be 'medium' -- &lt;/P&gt;&lt;P&gt;but i am not able to se why is it so.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Appreciate your help-&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jun 2015 05:56:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/If-Then-statement-output-is-strange-not-getting-desired-one/m-p/216712#M53340</guid>
      <dc:creator>Darpnew</dc:creator>
      <dc:date>2015-06-30T05:56:01Z</dc:date>
    </item>
    <item>
      <title>Re: If Then statement, output is strange -not getting desired one</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/If-Then-statement-output-is-strange-not-getting-desired-one/m-p/216713#M53341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The problem is 'if level = 2 or 3'&amp;nbsp; The answer to this is always yes. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data chk_10;&lt;/P&gt;&lt;P&gt;input sno name $ level;&lt;/P&gt;&lt;P&gt;if level = . then exp = 'unknown';&lt;/P&gt;&lt;P&gt;else if level = 1 then exp = 'low';&lt;/P&gt;&lt;P&gt;else if level = 2 or level = 3 then exp = 'medium';&lt;/P&gt;&lt;P&gt;else exp = 'high';&lt;/P&gt;&lt;P&gt;datalines;&lt;/P&gt;&lt;P&gt;1 Frank 1&lt;/P&gt;&lt;P&gt;2 John 2&lt;/P&gt;&lt;P&gt;3 sui 2&lt;/P&gt;&lt;P&gt;4 sose 1&lt;/P&gt;&lt;P&gt;5 burt 4&lt;/P&gt;&lt;P&gt;6 kelly .&lt;/P&gt;&lt;P&gt;7 juan 1&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another way would be to put if level &amp;gt; 3 then exp = 'high';&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jun 2015 12:51:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/If-Then-statement-output-is-strange-not-getting-desired-one/m-p/216713#M53341</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2015-06-30T12:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: If Then statement, output is strange -not getting desired one</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/If-Then-statement-output-is-strange-not-getting-desired-one/m-p/216714#M53342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The condition (LEVEL=2 or 3) is the same as ((LEVEL=2) or 3). Since 3 is always true this condition is always true.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jun 2015 14:35:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/If-Then-statement-output-is-strange-not-getting-desired-one/m-p/216714#M53342</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-06-30T14:35:53Z</dc:date>
    </item>
    <item>
      <title>Re: If Then statement, output is strange -not getting desired one</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/If-Then-statement-output-is-strange-not-getting-desired-one/m-p/216715#M53343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, could you just help me with another one?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;prog is:&lt;/P&gt;&lt;P&gt; data test_26;&lt;/P&gt;&lt;P&gt; infile Q26;&lt;/P&gt;&lt;P&gt; input empname $ 1-4;&lt;/P&gt;&lt;P&gt; if empname = 'Ruth' then input idnum 10-11;&lt;/P&gt;&lt;P&gt; else input age 7-8;&lt;/P&gt;&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt; proc print data = test_26;&lt;/P&gt;&lt;P&gt; title 'q26';&lt;/P&gt;&lt;P&gt; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;input is :&lt;/P&gt;&lt;P&gt;Ruth&amp;nbsp; 23 46&lt;/P&gt;&lt;P&gt;DP&amp;nbsp;&amp;nbsp;&amp;nbsp; 45 19&lt;/P&gt;&lt;P&gt;Cali&amp;nbsp; 34 23&lt;/P&gt;&lt;P&gt;Ruth&amp;nbsp; 21 89&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;output is coming as:&lt;/P&gt;&lt;P&gt;empname idnum age&lt;/P&gt;&lt;P&gt;Ruth&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 19&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/P&gt;&lt;P&gt;Cali&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 21&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I understand that while reading first record, only empname is read and the pointer moves to the second row - but I am not able to understand rest of the output. &lt;/P&gt;&lt;P&gt;Please help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jun 2015 15:14:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/If-Then-statement-output-is-strange-not-getting-desired-one/m-p/216715#M53343</guid>
      <dc:creator>Darpnew</dc:creator>
      <dc:date>2015-06-30T15:14:00Z</dc:date>
    </item>
    <item>
      <title>Re: If Then statement, output is strange -not getting desired one</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/If-Then-statement-output-is-strange-not-getting-desired-one/m-p/216716#M53344</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your first input statement&lt;/P&gt;&lt;P&gt;&lt;STRONG style="background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;input empname $ 1-4;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;tells SAS to load the contents of columns 1 to 4 into empname and step on to the next record.&amp;nbsp; To keep hold of the same record in case you need to load more data from it later in the data step, you need to use the trailing @ notation:&lt;/P&gt;&lt;P&gt;&lt;STRONG style="background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;input empname $ 1-4 @;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="background-color: #ffffff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jul 2015 01:53:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/If-Then-statement-output-is-strange-not-getting-desired-one/m-p/216716#M53344</guid>
      <dc:creator>dkb</dc:creator>
      <dc:date>2015-07-01T01:53:41Z</dc:date>
    </item>
  </channel>
</rss>

