<?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: How to use IFN function with multiple conditions? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-use-IFN-function-with-multiple-conditions/m-p/889328#M39512</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/446395"&gt;@IgorR&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;In This way IFN doesn't return any error or warning but doesn't the work as along version of code does.&lt;/P&gt;
&lt;P&gt;Where is a mistake?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You have NOT told us what is wrong. Saying it doesn't work gives us no useful information. What do you see that is wrong?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why do you switch from a variable named YEAR to a variable named PERIOD? Could that be the problem?&lt;/P&gt;</description>
    <pubDate>Tue, 15 Aug 2023 12:16:03 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2023-08-15T12:16:03Z</dc:date>
    <item>
      <title>How to use IFN function with multiple conditions?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-use-IFN-function-with-multiple-conditions/m-p/889324#M39509</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to make the following code to be shorter:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;	If Period = 40 Then Do;
			If Years &amp;gt; 20 and Years &amp;lt; 30 Then
				Effect_on_Guarantee = 1;
			Else Effect_on_Guarantee = Lapse_Multipliers;
		End;
	Else Effect_on_Guarantee = Lapse_Multipliers;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;To achieve this I'm trying to use IFN function like this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;IFN(a.Period = 40, IFN((a.Period  &amp;gt; 20 and a.Period &amp;lt; 30),1, Lapse_Multipliers),Lapse_Multipliers) As Effect_on_Guarantee&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;In This way IFN doesn't return any error or warning but doesn't the work as along version of code does.&lt;/P&gt;&lt;P&gt;Where is a mistake?&lt;/P&gt;</description>
      <pubDate>Tue, 15 Aug 2023 12:06:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-use-IFN-function-with-multiple-conditions/m-p/889324#M39509</guid>
      <dc:creator>IgorR</dc:creator>
      <dc:date>2023-08-15T12:06:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to use IFN function with multiple conditions?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-use-IFN-function-with-multiple-conditions/m-p/889327#M39511</link>
      <description>&lt;P&gt;Why would you want to convert readable code into a function call?&lt;/P&gt;
&lt;P&gt;If it is so you add it to an SQL statement then use CASE clause.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;case when (Period = 40) then
  case when (Years &amp;gt; 20 and Years &amp;lt; 30) then 1 else Lapse_Multipliers end
  else Lapse_Multipliers
end&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want to reduce the LOGIC of the test then do:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;case when ((Period = 40) and (Years &amp;gt; 20 and Years &amp;lt; 30)) then 1 
  else Lapse_Multipliers
end&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 15 Aug 2023 12:11:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-use-IFN-function-with-multiple-conditions/m-p/889327#M39511</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-08-15T12:11:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to use IFN function with multiple conditions?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-use-IFN-function-with-multiple-conditions/m-p/889328#M39512</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/446395"&gt;@IgorR&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;In This way IFN doesn't return any error or warning but doesn't the work as along version of code does.&lt;/P&gt;
&lt;P&gt;Where is a mistake?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You have NOT told us what is wrong. Saying it doesn't work gives us no useful information. What do you see that is wrong?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why do you switch from a variable named YEAR to a variable named PERIOD? Could that be the problem?&lt;/P&gt;</description>
      <pubDate>Tue, 15 Aug 2023 12:16:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-use-IFN-function-with-multiple-conditions/m-p/889328#M39512</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-08-15T12:16:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to use IFN function with multiple conditions?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-use-IFN-function-with-multiple-conditions/m-p/889333#M39514</link>
      <description>Oh, Thank you!&lt;BR /&gt;What a silly mistake.&lt;BR /&gt;The problem indeed in switching Years to Period.&lt;BR /&gt;Now I fixed it and it works.&lt;BR /&gt;</description>
      <pubDate>Tue, 15 Aug 2023 12:26:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-use-IFN-function-with-multiple-conditions/m-p/889333#M39514</guid>
      <dc:creator>IgorR</dc:creator>
      <dc:date>2023-08-15T12:26:16Z</dc:date>
    </item>
  </channel>
</rss>

