<?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 add one more condition in formula in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-add-one-more-condition-in-formula/m-p/482383#M124934</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;(dd=2)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;will give you a value of 1 if true, and 0 if false. Multiplying it with 1 solves no purpose.&lt;/P&gt;</description>
    <pubDate>Mon, 30 Jul 2018 07:28:54 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-07-30T07:28:54Z</dc:date>
    <item>
      <title>How to add one more condition in formula</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-add-one-more-condition-in-formula/m-p/482375#M124926</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here I have a sample dataset.&lt;/P&gt;&lt;P&gt;In the calculation method, I get confused in the line which I mention as comment&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input age bmi ht dd;
cards;
25 26.2 176 2
56 25.3 156 1
84 45.2 182 3
57 22.8 145 2
78 32.2 155 5
69 21.6 103 4;&lt;BR /&gt;&lt;BR /&gt;run;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
value =  
	1.235 +  
	(0.2*age) +  
	(1.13 * (dd=2)*1) + 
	(1.21*ht);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;/**(1.13 * dd[yes=1,no=0])) +**/&lt;BR /&gt;/**(dd=2,1)YES, (dd=Other dd value)NO**/&lt;BR /&gt;/**Here the condition reached for dd=2 so (1.13*1) else dd=(any) (1.13*0)**/&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Here the code states dd=2 so (Yes) it taken as 1&lt;/P&gt;&lt;P&gt;How do I add the another one condition for dd=1 in the same parameter. (dd=2,1 (YES) else (NO))&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jul 2018 06:51:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-add-one-more-condition-in-formula/m-p/482375#M124926</guid>
      <dc:creator>Sathish_jammy</dc:creator>
      <dc:date>2018-07-30T06:51:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to add one more condition in formula</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-add-one-more-condition-in-formula/m-p/482378#M124929</link>
      <description>&lt;P&gt;I can't say whether the logic is correct or not.&amp;nbsp; But you have to realize that the section you are adding to the formula would add 0 every time, so there is really no need to add it in this case.&amp;nbsp; At any rate, here's what the additional piece of the formula would look like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(1.13 * (dd=1) * 0) +&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it's possible that DD could be neither 1 nor 2, you might want:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(1.13 * (dd ne &lt;FONT color="#ff0000"&gt;1&lt;/FONT&gt;) * 0) +&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But either way, the net result is adding 0 to the original formula.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jul 2018 12:59:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-add-one-more-condition-in-formula/m-p/482378#M124929</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-07-30T12:59:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to add one more condition in formula</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-add-one-more-condition-in-formula/m-p/482383#M124934</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;(dd=2)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;will give you a value of 1 if true, and 0 if false. Multiplying it with 1 solves no purpose.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jul 2018 07:28:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-add-one-more-condition-in-formula/m-p/482383#M124934</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-07-30T07:28:54Z</dc:date>
    </item>
  </channel>
</rss>

