<?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: Creating a conditional Variable in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-conditional-Variable/m-p/320448#M21465</link>
    <description>&lt;P&gt;For binary choices such as these, your easiest method is either ifn() to return a numeric value or ifc() to return a character. &amp;nbsp;They both have the form:&lt;/P&gt;
&lt;P&gt;&amp;lt;variable&amp;gt;=ifn(&amp;lt;condition&amp;gt;,&amp;lt;result positive value&amp;gt;,&amp;lt;result negative value&amp;gt;);&lt;/P&gt;
&lt;P&gt;So in your case you can say:&lt;/P&gt;
&lt;P&gt;employee=ifc(payinc &amp;gt;= 50,'Y','N');&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that in the above I am guessing that payinc is numeric (as that would make most sense), if its character - and why are you storing numbers in character fields - then you need to input it first.&lt;/P&gt;</description>
    <pubDate>Wed, 21 Dec 2016 09:31:47 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2016-12-21T09:31:47Z</dc:date>
    <item>
      <title>Creating a conditional Variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-conditional-Variable/m-p/320443#M21464</link>
      <description>&lt;P&gt;Folks,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to create a condtional variable such that if PAYE income is greater than or equal to 50% of gross income then employee = Y if not employee = N&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Initially I wanted something as, but the following code doesn't work. Could anyone recommend anything to me, please?&lt;/P&gt;&lt;PRE&gt;if payeinc&amp;gt;=50% grossinc then 
		employee='Y';
		else employee ='N';&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Dec 2016 09:19:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-conditional-Variable/m-p/320443#M21464</guid>
      <dc:creator>Sean_OConnor</dc:creator>
      <dc:date>2016-12-21T09:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a conditional Variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-conditional-Variable/m-p/320448#M21465</link>
      <description>&lt;P&gt;For binary choices such as these, your easiest method is either ifn() to return a numeric value or ifc() to return a character. &amp;nbsp;They both have the form:&lt;/P&gt;
&lt;P&gt;&amp;lt;variable&amp;gt;=ifn(&amp;lt;condition&amp;gt;,&amp;lt;result positive value&amp;gt;,&amp;lt;result negative value&amp;gt;);&lt;/P&gt;
&lt;P&gt;So in your case you can say:&lt;/P&gt;
&lt;P&gt;employee=ifc(payinc &amp;gt;= 50,'Y','N');&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that in the above I am guessing that payinc is numeric (as that would make most sense), if its character - and why are you storing numbers in character fields - then you need to input it first.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2016 09:31:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-conditional-Variable/m-p/320448#M21465</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-12-21T09:31:47Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a conditional Variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-conditional-Variable/m-p/320449#M21466</link>
      <description>&lt;P&gt;Are you using Query builder? If so, try a computed calculation and choose recode to use the GUI to create the code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or use an advanced expression and a CASE statement.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS note: How to apply if/then logic in SAS EG&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/kb/32/160.html" target="_blank"&gt;http://support.sas.com/kb/32/160.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2016 09:32:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-conditional-Variable/m-p/320449#M21466</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-21T09:32:47Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a conditional Variable</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-conditional-Variable/m-p/320450#M21467</link>
      <description>&lt;P&gt;And the condition needs to be correct&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;payeinc &amp;gt; 0.5*gross_incone&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Dec 2016 09:34:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Creating-a-conditional-Variable/m-p/320450#M21467</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-21T09:34:10Z</dc:date>
    </item>
  </channel>
</rss>

